Hello devscripts developers,

I don't have access to a Debian box but would like to submit a patch for 
manpage-alert.sh (which among a few other utilities from devscripts I'm about 
to introduce in Fedora's rpmdevtools package), hopefully it's ok to send the 
patch this way.

The problem is that executable names end up in the sed regex unquoted, which 
causes sed errors in some cases.  Another problem is that the current 
implementation requires a word boundary before a command's name which doesn't 
work as intended if the command's basename does not start with a word 
character.

Both problems occur for example with the executable "/usr/bin/[".  A patch 
fixing both issues is attached; perhaps there's a way to do this with sed but 
I don't think perl is that bad for the job, and perl is what I could fix it 
with ;)
Index: scripts/manpage-alert.sh
===================================================================
--- scripts/manpage-alert.sh	(revision 1942)
+++ scripts/manpage-alert.sh	(working copy)
@@ -67,8 +67,8 @@
         if [ $RET = "0" ]; then
             NUM_MANPAGES_FOUND=$(( $NUM_MANPAGES_FOUND + 1 ))
         else
-            echo "$OUT" | sed -e "/^.*'man 7 undocumented'.*$/ d" \
-              -e "s,\(.\)\b${F##*/}(\b|$),\1$F," -e 's,//,/,'
+            echo "$OUT" | perl -pe "s/^.*'man 7 undocumented'.*$// ; \
+              s,(\W)\Q${F##*/}\E(\b|$),\1$F, ; s,//,/,"
             NUM_MANPAGES_MISSING=$(( $NUM_MANPAGES_MISSING + 1 ))
         fi
     done

Reply via email to