Did new git show to diff file, re-executed vim line to reread file, yet old 
patch was
included. WTH. Ah, it was because I then had renamed the diff file, ouch, sorry!



commit ce4489aa88f8439c2bca79c2d2b3088b535222bb
Author: Andreas Mohr <and...@users.sf.net>
Date:   Wed Aug 28 10:00:59 2013 +0200

    Protect against the user passing multiple different debirf write mode 
options.
    
    Since there are multiple redundant -n/-o/-s switches rather than a
    single mode switch, we need to guard against the user accidentally passing 
in
    multiple incompatible (and thus overriding/overwriting! as in the "-s -n"
    i.e. want-skip yet then overridden by --new case) write mode requests.

diff --git a/src/debirf b/src/debirf
index d1a54cc..d91c9bc 100755
--- a/src/debirf
+++ b/src/debirf
@@ -349,14 +349,17 @@ make() {
                ;;
             -n|--new)
                WRITE_MODE=rewrite
+               write_mode_rewrite_given=1
                shift 1
                ;;
             -o|--overwrite)
                WRITE_MODE=overwrite
+               write_mode_overwrite_given=1
                shift 1
                ;;
             -s|--skip)
                WRITE_MODE=skip
+               write_mode_skip_given=1
                shift 1
                ;;
             -r|--root-build)
@@ -393,6 +396,18 @@ make() {
                ;;
        esac
     done
+    # Protect against misuse of redundant write mode implementation
+    # (multiple -n/-o/-s switches), see #721094.
+    # Do this by adding extra helper flags above
+    # that are to be increment-evaluated here,
+    # to avoid disallowing e.g. a duplicate -s -s case.
+    write_mode_argcount=0
+    [ -n "${write_mode_rewrite_given}" ] && 
write_mode_argcount=$((write_mode_argcount+1))
+    [ -n "${write_mode_overwrite_given}" ] && 
write_mode_argcount=$((write_mode_argcount+1))
+    [ -n "${write_mode_skip_given}" ] && 
write_mode_argcount=$((write_mode_argcount+1))
+    if [ ${write_mode_argcount} -gt 1 ]; then
+       failure "Multiple different write mode switches (-n/-o/-s) given - 
please resolve this command line conflict."
+    fi
     
     if [ $(id -u) = '0' ] ; then
        cat <<EOF


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to