Skip to contentSkip to conversation

linguas: Ensure that linguas.sh runs from the directory that it resides

PATCH In review Glenn Washburn 2 participants 2 messages Nov 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 linguas: Ensure that linguas.sh runs from the directory that it resides

The script assumes that it is run from the root of the source tree, which is where it is located. So this should be enforced to prevent accidental misuses.

realpath is used instead of readlink as that is recommended in Debian's readlink manpage since at least Debian 11. Also, use the shell variable's parameter expansion for removing a suffix pattern to get the directory in which the script resides. This is preferable to using the dirname binary as it avoids creating a new process.

---
 linguas.sh | 5 +++++
 1 file changed, 5 insertions(+)
linguas.sh +5 -0
index b95ad4f7d9c2..45cdf2ac14ac 100755
@@ -1,5 +1,10 @@
 #!/bin/sh
 
+SDIR=$(realpath -e "$0")
+SDIR=${SDIR%/*}
+
+cd "$SDIR"
+
 rsync -Lrtvz translationproject.org::tp/latest/grub/ po
 
 autogenerated="en@quot en@hebrew de@hebrew en@cyrillic en@greek en@arabic en@piglatin de_CH"
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Glenn Washburn

The script assumes that it is run from the root of the source tree, which is where it is located. So this should be enforced to prevent accidental misuses.

realpath is used instead of readlink as that is recommended in Debian's readlink manpage since at least Debian 11. Also, use the shell variable's parameter expansion for removing a suffix pattern to get the directory in which the script resides. This is preferable to using the dirname binary as it avoids creating a new process.

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel