Bug#844560: check for config file existence is wrong

Mattia Rizzolo mattia at debian.org
Wed Nov 16 23:51:37 UTC 2016


On Wed, 16 Nov 2016, 10:36 p.m. Ian Jackson, <
ijackson at chiark.greenend.org.uk> wrote:

> Package: pbuilder
> Version: 0.226.1
>
> zealot:~> pbuilder dumpconfig --configfile /dev/null
> E: Config file /dev/null does not exist
> zealot:~>
>
> If it just tried to source it, rather than (presumably) pre-checking
> it with "test", it would say something like this:
>


It does a regular
    if [ -f "$RCFILE" ]; then
        . "$RCFILE"
    else
        echo "W: $RCFILE does not exist" >&2
    fi

Which fails for non-regular files like /dev/null is.

zealot:~> bash -c '. /dev/enoent'
> bash: /dev/enoent: No such file or directory
> zealot:~>
>
> I think that would probably be preferable...
>

Do you mean that probably the message should takr into account that a
reason for failure of that test could be something different than enonet?

If that the problem it could prably be solved imho in a nicer way by
nesting another if in the else branch to check for simple existence (by [
-e $file ]) and print a proper message if the file exists but it's not
regular, and keep the current message only for the real enoent case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pbuilder-maint/attachments/20161116/db008969/attachment.html>


More information about the Pbuilder-maint mailing list