[comp.unix.ultrix] ln -s gives wrong error message on Ultrix 4.1

D. Allen [CGL]" <idallen@watcgl.waterloo.edu> (04/10/91)

For a nonexistent pathname "xxx" and a directory into which I do not
have permission to write "/", Ultrix issues the wrong error message:

On a MIPS system here:

    1% ln -s xxx /
    //xxx: Permission denied                               <- correct
    2% touch /tmp/xxx
    3% ln -s /tmp/xxx /
    //xxx: Permission denied

On a 4.3 BSD system here:

    1% ln -s xxx /
    //xxx: Permission denied                               <- correct
    2% touch /tmp/xxx
    3% ln -s /tmp/xxx /
    //xxx: Permission denied

On a SunOS 4.1 system here:

    1% ln -s xxx /
    ln: //xxx: Permission denied                           <- correct
    2% touch /tmp/xxx
    3% ln -s /tmp/xxx /
    ln: //xxx: Permission denied

On Ultrix 4.1:

    1% ln -s xxx /
    xxx: No such file or directory                         <- What?!
    2% touch /tmp/xxx
    3% ln -s /tmp/xxx /
    //xxx: Permission denied

The "No such file or directory" that Ultrix issues is not correct for #1.
The presence or absence of the link content should not affect the fact
that I don't have permission to make the symbolic link.

Ultrix should say, like everyone else, "Permission denied".  
(It should also put the command name "ln:" in the error messages.)

Same problem on Ultrix 3.1 and Ultrix 3.1C.  It gets marks for consistency.
-- 
-IAN! (Ian! D. Allen) idallen@watcgl.uwaterloo.ca idallen@watcgl.waterloo.edu
 [129.97.128.64]  Computer Graphics Lab/University of Waterloo/Ontario/Canada

jv@mh.nl (Johan Vromans) (04/11/91)

In article <1991Apr9.194356.24156@watcgl.waterloo.edu> idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) writes:

> For a nonexistent pathname "xxx" and a directory into which I do not
> have permission to write "/", Ultrix issues the wrong error message:
>...
>     1% ln -s xxx /
>     xxx: No such file or directory                         <- What?!
>...
> The "No such file or directory" that Ultrix issues is not correct for #1.
> The presence or absence of the link content should not affect the fact
> that I don't have permission to make the symbolic link.

It doesn't. In this case, you deserve two error messages: ENOENT
*AND* EPERM.

> Ultrix should say, like everyone else, "Permission denied".  

I do not agree. To me, it is more logical to check source first. If
you do not have a (valid) source, there is no need worrying about the
destination. 
But I can imagine that checking destination first also has it points.

> (It should also put the command name "ln:" in the error messages.)

I agree on this one.

	Johan
-- 
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp: ..!{uunet,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
------------------------ "Arms are made for hugging" -------------------------

envbvs@epb7.lbl.gov (Brian V. Smith) (04/12/91)

In article <1991Apr11.080051.10756@pronto.mh.nl>, jv@mh.nl (Johan Vromans)
writes:
|> 
|> In article <1991Apr9.194356.24156@watcgl.waterloo.edu>
|> idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) writes:
|> 
|> > For a nonexistent pathname "xxx" and a directory into which I do not
|> > have permission to write "/", Ultrix issues the wrong error message:
|> >...
|> >     1% ln -s xxx /
|> >     xxx: No such file or directory                         <- What?!
|> >...
|> > The "No such file or directory" that Ultrix issues is not correct for #1.
|> > The presence or absence of the link content should not affect the fact
|> > that I don't have permission to make the symbolic link.
|> 
|> It doesn't. In this case, you deserve two error messages: ENOENT
|> *AND* EPERM.
|> 
|> > Ultrix should say, like everyone else, "Permission denied".  
|> 
|> I do not agree. To me, it is more logical to check source first. If
|> you do not have a (valid) source, there is no need worrying about the
|> destination. 
|> But I can imagine that checking destination first also has it points.

No, no, no.  There is no reason that the source must exist when the symlink 
is created.  That is one of the nice things about symlinks.   It is simple
string substitution.  Try the following:  ln -s xxx aaa    
It works fine even when xxx doesn't exist, as long as one has permission
to create aaa.

-- 
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL; they don't pay me enough for that.

jv@mh.nl (Johan Vromans) (04/13/91)

In article <11998@dog.ee.lbl.gov> envbvs@epb7.lbl.gov (Brian V. Smith) writes:

| In article <1991Apr11.080051.10756@pronto.mh.nl>, jv@mh.nl (Johan Vromans)
| writes:
| |> [on a problem with "ln -s"] :
| |> I do not agree. To me, it is more logical to check source first. If
| |> you do not have a (valid) source, there is no need worrying about the
| |> destination. 

| No, no, no.  There is no reason that the source must exist when the symlink 
| is created.

*IF* the semantics of symlinks do not require the source to be
present, then I agree fully. In this case, you may consider EPERM to
be an error, and ENOENT a warning. And errors take precedence over
warnings.

In the general situation of an input and output file, I thing checking
input before output is intuitive.

	Johan
-- 
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp: ..!{uunet,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
------------------------ "Arms are made for hugging" -------------------------