On 08/27/2013 05:40 PM, Andreas Mohr wrote:
> after some progress with debirf (i.e., a rootfs finally successfully created),
> I decided to start using debirf -s (WRITE_MODE=skip)
> yet by simply having it *inserted* to my prior cmdline without realizing
> that -s WRITE_MODE setting would get overwritten by my leftover
> subsequent -n (WRITE_MODE=rewrite) or -o (WRITE_MODE=overwrite) options.
> --> Result: debootstrap called again despite not wanting it this time...
> 
>     while true ; do
>         case "$1" in
> ...
>             -n|--new)
>                 WRITE_MODE=rewrite
>                 shift 1
>                 ;;
>             -o|--overwrite)
>                 WRITE_MODE=overwrite
>                 shift 1
>                 ;;
>             -s|--skip)
>                 WRITE_MODE=skip
>                 shift 1
>                 ;;
> ...
> 
> (witness --skip getting overwritten by any subsequent --new / --overwrite
> in this while loop)
> 
> 
> The root cause of my confusion case is that -n -o -s parameters are
> wholly redundant: instead, they are supposed to be a *single* *mode* switch,
> to cleanly reflect exactly how it's implemented within-script 
> (WRITE_MODE=xxx),
> since this seems appropriate here.
> 
> These redundant options should thus be deprecated in favour of e.g. a combined
> -m (--mode) switch taking rewrite/overwrite/skip arguments, I'd think
> (and probably add a deprecation warning for a while,
> whenever the old switches happen to get used).

If i understand correctly, checking for redundant options and
terminating with a non-zero error code and a warning would have avoided
your problem without breaking compatibility with existing scripts that
use only one of the options.

I'd welcome a patch that implements such a check.  I'd rather not add a
new command-line option (e.g. --mode) if we can avoid it.

Thanks for pointing this out!

        --dkg

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to