From owner-freebsd-hackers Fri Jan 26 17:42:18 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp3.xs4all.nl (smtp3.xs4all.nl [194.109.127.132]) by hub.freebsd.org (Postfix) with ESMTP id E276537B401 for ; Fri, 26 Jan 2001 17:41:53 -0800 (PST) Received: from localhost (s340-modem1762.dial.xs4all.nl [194.109.166.226]) by smtp3.xs4all.nl (8.9.3/8.9.3) with SMTP id CAA27933 for ; Sat, 27 Jan 2001 02:41:48 +0100 (CET) Message-ID: <3A7226D6.41C67EA6@xs4all.nl> Date: Sat, 27 Jan 2001 01:39:34 +0000 From: "W.H.Scholten" Organization: . X-Mailer: Mozilla 3.04 (X11; I; FreeBSD 4.1-RELEASE i386) MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.ORG Subject: More error message changes? (Re: mkdir diff) 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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