delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/31/06:23:22

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E117C37.F40D7EC7@phekda.freeserve.co.uk>
Date: Tue, 31 Dec 2002 11:15:03 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: fileutils 4.1: ls and symlinks [PATCH]
References: <200212310028 DOT gBV0S7t27149 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

ams AT ludd DOT luth DOT se wrote:
> 
> According to Richard Dawe:
> > Below is a patch for 'ls' from fileutils 4.1. It's another case
> > where the path handling needs to be updated to cope
> > with DOS-style absolute paths.
[snip]

OK, maybe this comment is slightly bogus. Read "drive-qualified DOS-style
paths" instead of "DOS-style absolute paths".

> > This patch is important, because the test suite uses symlinks
> > extensively and uses 'ls' to check that 'cp', 'mv', etc.
> > handle symlinks correctly.
> ...
> > --- gnu.dev/filutil4.1-rel/src/ls.c   2002-10-06 10:33:32.000000000 +0000
> > +++ gnu.dev/filutil4.1-rel.work/src/ls.c      2002-12-18 16:54:04.000000000 +0000
> > @@ -2155,6 +2155,13 @@ make_link_path (const char *path, const
> >    if (linkname == 0)
> >      return 0;
> >
> > +#ifdef MSDOS
> > +  /* Any filename with a drive specification should be
> > +   * treated as an absolute pathname on MS-DOS.  */
> > +  if (linkname[0] && (linkname[1] == ':'))
> > +    return xstrdup (linkname);
> > +#endif
> 
> Uhoh! That's not true. If in COMMAND.COM I do "a:
> cd \dos
> c:
> cp aaa.tst a:" I think aaa.tst should go into a:/dos not into a:/. At
> least that's what's been happening to me with some version cp while
> I've been moving files between computers which doesn't have a network
> connection.

I'm not saying c:foo is an absolute path. The code in make_link_path should
/treat/ it like an absolute path. If the path is relative, it prepends the
current path. If the path is absolute it leaves it as-is. The case of c:foo we
have something inbetween, but we treat it as absolute, since we can't prepend
the current path.

BTW I agree that cp (and the other fileutils) should behave as you say. I
tested out their handling of drive letters a fair amount. If you find any bugs
in handling of paths like c:foo, c:somedir/foo, etc., please let me know.

> I think for an absolute path in DOZE should start with / or X:/. (And
> a really really absolute path must start with X:/, although I won't
> push that.)

Yes, I agree, including the "really really" absolute path. ;)

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019