Meta: Find potentially missing resources

This commit is contained in:
Ben Wiederhake 2020-07-27 06:33:48 +02:00 committed by Andreas Kling
parent 5692fa6c39
commit eccf96b703
3 changed files with 20 additions and 2 deletions

View file

@ -55,7 +55,7 @@ This is all possibly by using HackStudio, Visual Builder, Terminal, and the
(optional) GNU tools.
* Multimedia
$ /res/icons/audio-unmuted.png
$ /res/icons/audio-volume-medium.png
> Draw while playing your favorite songs!
Serenity includes the Piano, which allows you to create your own tunes by
simply pressing keys on the keyboard. You can pick the wavetype, octave, and

View file

@ -12,7 +12,7 @@ In addition to the access permissions bits, executables may have the "Set User I
The motivation behind SUID binaries is that they allow users to do tasks that would normally require elevated permissions, without having to give users these permissions fully.
For example, `/usr/ping` has the Set User ID bit set and is owned by user root in group root. So if any process executes `/usr/ping`, it will run as root, which means it will be able to send network packets, even if the current process doesn't normally have network access.
For example, `/bin/ping` has the Set User ID bit set and is owned by user root in group root. So if any process executes `/bin/ping`, it will run as root, which means it will be able to send network packets, even if the current process doesn't normally have network access.
For another example, many other Unix systems contain a utility `passwd` that changes the password of the current user. To store the password, it has to write to `/etc/shadow` -- but the current user is not supposed to have write access to `/etc/shadow` so that they cannot change passwords of other users. The solution is to make `passwd` a SUID binary. (SerenityOS currently doesn't have support for user passwords.)

18
Meta/lint-missing-resources.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
set -e pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "$script_path/.."
# The dollar symbol in sed's argument is for "end of line", not any shell variable.
# shellcheck disable=SC2016
grep -Pirh '(?<!file://)(?<!\.)(?<!})(?<!\()/(etc|res|usr|www)/' AK/ Applications/ Base Demos/ DevTools/ Documentation/ Games/ Kernel/ Libraries/ MenuApplets/ Services/ Shell/ Userland/ | \
sed -re 's,^.*["= `]/([^"%`: ]+[^"%`: /.])/?(["%`: .].*)?$,\1,' | \
sort -u | \
while read -r referenced_resource
do
if ! [ -r "Base/${referenced_resource}" ] && ! [ -r "Build/Root/${referenced_resource}" ]
then
echo "Potentially missing resource: ${referenced_resource}"
fi
done