Why does "cd /usr/////bin" = "cd /usr/bin"?

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Brett J. Hero » Fri, 20 Sep 1991 11:32:22



This created $HOME/filename !?

date > $HOME///////filename

No common sense reason for this has occurred to me.


 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by D'Arcy J.M. Ca » Sat, 21 Sep 1991 12:27:29



Quote:>This created $HOME/filename !?
>date > $HOME///////filename
>No common sense reason for this has occurred to me.

It means that your programs can do things like:

  printf(Enter directory name: ");
  gets(file_name);
  strcat(file_name, "/basename");

Whereas in DOS you wind up doing:

  printf(Enter directory name: ");
  gets(file_name);
  if (file_name[strlen(file_name) - 1] == '\\')
        strcat(file_name, "basename");
  else
        strcat(file_name, "\\basename");

Actually it's worse since both slash and backslash are acceptable so you
really have to test for both.

If directory separators didn't collapse then what would "$HOME/////filename"
mean?

--

D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871          DoD#0082  |

 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Jeff Beadl » Sun, 22 Sep 1991 08:28:37



Quote:>This created $HOME/filename !?
>date > $HOME///////filename
>No common sense reason for this has occurred to me.

Well, in the typical unix tradition, this has mutated into
    date > $HOME/././././././filename

However, most of the kernel's that I have seen all strip multiple '/' within
the middle of a pathname.

Several versions of "unix" treat leading double shashes "//foo" as a special
case.  Examples of these are Domain OS (Apollo) and older versions of UTek
(Tektronix, rip)

        -Jeff
--

 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by James Risn » Mon, 23 Sep 1991 08:09:57



>Several versions of "unix" treat leading double shashes "//foo" as a special
>case.  Examples of these are Domain OS (Apollo) and older versions of UTek
>(Tektronix, rip)

I am rather curious as to what special case "//foo" would signal?

James Risner

 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Dr. Peter Li » Sat, 21 Sep 1991 15:43:54



Quote:

>This created $HOME/filename !?

>date > $HOME///////filename

>No common sense reason for this has occurred to me.

WHAT did you expect anyway? Anything else happening would make less sense
I think, except may be an error message.

Peter

 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Jim Willia » Wed, 25 Sep 1991 23:08:29


The Posix standard (see sections 2.3 and 2.4) requires that multiple
slashes in a pathname be interpreted as a single slash.  The one
exception to this is when the path begins with slash.  In that one
case, is it permitted for an implementation to give special meaning to
a pathname that begins with exactly two slashes.  This is how some
Unixes implement remote file systems.  For example,
//remotehost/usr/local/foo might be the file /usr/local/foo on the
machine named remotehost.  Any other use of multiple slashes, such as
////remotehost/usr/local/foo or /usr////////////local/foo must be
treated as though there were one slash.

This behavior is reasonable and desirable.  On more than one
occasion, I've used a command such as

% mv f1 foo/bar/baz     # baz is a directory, so file will be foo/bar/baz/f1

to move a file into a new directory without changing it's name.
Now, if I do this and misspell "baz", then instead of putting the
file in the directory foo/bar/baz, I end up with a file named
foo/bar/bax, or something like that.  After doing this enough times,
I've gotten in the habbit of ALWAYS putting a slash at the end of
directory names in such cases.

% mv f1 foo/bar/baz/

Now if I misspell baz, the mv will fail, since the directory
foo/bar/bax doesn't exist.  When I do spell baz correctly, mv almost
surely generates the target pathname internally as foo/bar/baz//f1,
so this trick of mine will only work if multiple slashes are treated
sensibly.  This does NOT work under DOS...

% COPY F1.C SOURCE\

will barf.  Stupid DOS.

Jim
--

USPS: NASA/Goddard SFC; Code 933; Greenbelt, MD 20771
Phone: +1 301 286-1131          Maryland Car Tags: DEV CAR
Motto: There is no 'd' in "kluge"!  It rhymes with "huge", not "sludge"!

 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Guy Harr » Thu, 26 Sep 1991 03:02:00


Quote:>I am rather curious as to what special case "//foo" would signal?

In Domain/OS and, I think, some other systems, "//foo/bar" was "file
named 'bar' in the root directory of the machine named 'foo'".
 
 
 

Why does "cd /usr/////bin" = "cd /usr/bin"?

Post by Dan Fl » Wed, 25 Sep 1991 03:50:45




> >Several versions of "unix" treat leading double shashes "//foo" as a special
> >case.  Examples of these are Domain OS (Apollo) and older versions of UTek
> >(Tektronix, rip)

> I am rather curious as to what special case "//foo" would signal?

The double slash in UTek means a host on the same network with
you. So, it means that you can

cp *.c //r2d2/usr/local/src/foo.

to copy files from wherever you are to /usr/local/src/foo
on host, r2d2. You can also:

cd //r2d2/usr/users/foo

and

//c3p0/usr/local/bin/ispell foobar.
--
          Dan Flak - Just another idiot, born in the USA and over 35.

 
 
 

1. execl( ..."/usr/bin/passwd", "username" ... ) ????

I want to create a process to execute passwd. I have the required
information: username, old_password, new_password, and have a pipe
created between the parent and child ready for the child (passwd)
to read (stdin) from the parent. What is the communuication protocol
with an interactive process like passwd? How are the responses from the
parent interleaved with passwd requests for old password, new password,
new password? How is this type of exchange implemented?

Purpose: For POPMail users on a wide area network to change their UNIX
passwords via a web page.

Thanks,
KFW u

--
sig schmig

2. steps for changing modules.conf .. quick question

3. more secure?: "#!/bin/sh -" or "#!/bin/sh"

4. Top 10 posters comp.unix.shell

5. "cd -L /usr/adm ; lc .." == "lc /var" ??

6. ftp server

7. "/usr" versus "/usr/local"

8. Iomega Atapi Zip help for Newbie

9. GETSERVBYNAME()????????????????????"""""""""""""

10. Exec("/usr/bin/mailx -s \"fun bun\" mat.aida@cbs.dk)

11. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

12. How to get "cd dir" working as "cd dir ; pwd"?

13. Type "(", ")" and "{", "}" in X...