Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Jan 2001 01:39:34 +0000
From:      "W.H.Scholten" <whs@xs4all.nl>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   More error message changes? (Re: mkdir diff)
Message-ID:  <3A7226D6.41C67EA6@xs4all.nl>
References:  <3A5C843C.794BDF32@xs4all.nl> <20010111132509.J7240@fw.wintelcom.net> <3A5EE6B1.41C67EA6@xs4all.nl> <20010112081422.U7240@fw.wintelcom.net> <3A6025F1.794BDF32@xs4all.nl> <20010113191432.G7240@fw.wintelcom.net> <20010114041041.M7240@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
There were a few other places where I noticed (long time ago, but I've
now written it all down) somewhat strange messages:

mkdir / gives:
        mkdir: /: Is a directory

whereas mkdir /usr gives:
        mkdir: /usr: File exists

Is this a bug in the kernel to return EISDIR in case of "/" or is it a
'feature'?

Further, various other programs have a variant of the message weirdness
that mkdir had, though this is defensible in some cases as another
message is added, e.g. in sh:  echo "aa" >/tmp/a/b gives: cannot create
/tmp/a/b: directory nonexistent.

The other cases are present in rm, touch, chmod, cat, ls, cp, mv
(possible more...). The messages are all ok if one remembers the exact
meaning of the error message as decribed in intro(2) but the short
messages that strerror et al produce are misleading when one does not
expand further (as opposed to e.g. the sh example)

For the following I assume /tmp/e is a file, and /tmp/a does not exist.
rm /tmp/e/f gives:
        rm: /tmp/e/f: Not a directory
(better: rm: /tmp/e: Not a directory)

touch /tmp/a/b:
        touch: /tmp/a/b: No such file or directory
(better: touch: /tmp/a: No such file or directory, as touch is supposed
to create the file if it doesn't exist)

touch /tmp/e/f:
        touch: /tmp/e/f: Not a directory
(better: touch: /tmp/e: Not a directory)

chmod +x /tmp/e/f:
        chmod: /tmp/e/f: Not a directory
(better: chmod: /tmp/e: Not a directory)

cat /tmp/e/f:
        cat: /tmp/e/f: Not a directory
(better: cat: /tmp/e: Not a directory)

ls /tmp/e/f:
        ls: /tmp/e/f: Not a directory
(better: ls: /tmp/e: Not a directory)

cp /tmp/e/f f:
        cp: /tmp/e/f: Not a directory
(better: cp: /tmp/e: Not a directory)

mv /tmp/e/f f
        mv: rename /tmp/e/f to f: Not a directory
if g does not exist:
mv /tmp/e/f g/f
        mv: rename /tmp/e/f to g/f: Not a directory

(not sure what do to here, 2 directories, so check/mention both with an
expanded message?)

Of course, these messages can changed by changing:
	1. the messages that go with errno, e.g. "Not a directory" to  "Part of
the directory name is not a directory" or something
	2. check for these cases in the given programs.
	3. expand the error message as sh does.

I actually like the idea of making the messages that strerror produces
more verbose but maybe everyone feels the current messages should stay
as they are standard?.

Regards,

Wouter




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A7226D6.41C67EA6>