bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils 5.93, more bad error messages on Solaris


From: Keith Thompson
Subject: Re: coreutils 5.93, more bad error messages on Solaris
Date: Mon, 5 Dec 2005 14:30:30 -0800
User-agent: Mutt/1.4.1i

On Mon, Dec 05, 2005 at 11:10:22PM +0100, Jim Meyering wrote:
> Keith Thompson <address@hidden> wrote:
> > I'm seeing some more misleading error messages in corutils 5.93
> > on Solaris.  These are similar to the problem I reported on
> > Mon 2005-10-31, subject
> >     coreutils 5.92, rm <dir> on Solaris, bad error message
> > (corrected in 5.93).
> >
> > % ls -ls tmp
> > 0 -rw-r--r-- 1 kst sys200 0 Dec  5 13:41 tmp
> > % uname -a
> > SunOS elmak 5.9 Generic_117171-17 sun4u sparc SUNW,Sun-Blade-100 Solaris
> > % ls -l tmp
> > -rw-r--r-- 1 kst sys200 0 Dec  5 13:41 tmp
> > % chown --version | head -1
> > chown (GNU coreutils) 5.93
> > % chown root tmp
> > chown: changing ownership of `tmp': Not owner
> > % chgrp --version | head -1
> > chgrp (GNU coreutils) 5.93
> > % chgrp root tmp
> > chgrp: changing group of `tmp': Not owner
> 
> Thanks for the report.
> 
> However, the problem is that the chown syscall fails with EPERM,
> which renders (on Solaris) as `Not owner' in English.
> Since Sun's /usr/bin/chown and chgrp work the same way,
> I'm in no hurry to `fix' it.
> 
> On Linux, I get the more sensible (at least in this case)
> `Operation not permitted'.

Is see, so the problem is with the message string that the OS assigns
to the errno value, not with the value errno is being set to.

This program:
========================================================================
#include <stdio.h>
#include <errno.h>

static void show(int num)
{
    printf("%6d  ", num);
    switch(num) {
        case EPERM:
            printf("EPERM");
            break;
        case EACCES:
            printf("EACCES");
            break;
        default:
            printf("?");
            break;
    }
    printf(" \"%s\"\n", strerror(num));
}

int main(void)
{
    show(EPERM);
    show(EACCES);
    return 0;
}
========================================================================

produces the following output on Solaris:
     1  EPERM "Not owner"
    13  EACCES "Permission denied"

and the following on Linux:
     1  EPERM "Operation not permitted"
    13  EACCES "Permission denied"

(It seems to me that it would have made a lot more sense for EPERM
to be rendered as "Permission denied".)

Just to add to the confusion, the comments in /usr/include/sys/errno.h
on Solaris are misleading in yet another way:

#define EPERM   1       /* Not super-user                       */
[...]
#define EACCES  13      /* Permission denied                    */

Sigh.

-- 
Keith Thompson (The_Other_Keith) address@hidden  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]