bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gettext 0.10.35: Missing error checking in gettextize


From: Johannes Kloos
Subject: gettext 0.10.35: Missing error checking in gettextize
Date: Tue, 25 Sep 2001 14:53:09 +0200
User-agent: Mutt/1.2.5i

Hello all,
during a usenet discussion I discovered a bug in the gettextize script.
If the data directory of gettext (${prefix}/share/gettext) doesn't
exist, gettextize will delete all files in the source directory.
The bug is in the follwing code segment:

        # For simplicity we changed to the gettext source directory.
        cd $gettext_dir
        ^^^^^^^^^^^^^^^
Error-checking must be done here...

        # Now copy all files.  Take care for the destination
        # directories.
        for file in *; do
          case $file in
            intl | po | demo)
              ;;
            *)
              rm -f $srcdir/$file
or this will delete all files in the source directory.
              ($try_ln_s && ln -s $gettext_dir/$file $srcdir/$file) \
                        2>/dev/null || cp $file $srcdir/$file
              ;;
          esac
        done

As a solution, I'd suggest the follwing patch that treats this as a
"can't happen" error:

--- SNIP ---
--- gettextize.gnu      Tue Sep 25 14:50:09 2001
+++ gettextize  Tue Sep 25 14:51:24 2001
@@ -125,7 +125,10 @@
 }

 # For simplicity we changed to the gettext source directory.
-cd $gettext_dir
+cd $gettext_dir || {
+   $echo "failed to change the working directory to $gettext_dir"
+   exit 1
+}

 # Now copy all files.  Take care for the destination directories.
 for file in *; do
--- SNIP ---

-- 
Johannes Kloos
It's a metaphor of human bloody existence, a dragon. And if that wasn't
bad enough, it's also a bloody great hot flying thing.
-- Captain Vimes ponders his problems (Terry Pratchett, Guards! Guards!)

Attachment: pgpiB9isx3Dgw.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]