Subject: Re: CVS commit: src/usr.bin/find
To: Zafer Aydogan <zafer@gmx.org>
From: Elad Efrat <elad@NetBSD.org>
List: source-changes
Date: 10/21/2005 03:21:56
Zafer Aydogan wrote:

> I discovered it writing a shell skript for
> NetBSD.

That does what? send PRs?

> I discovered that find was working with double slashes.

I'm sure many people "discovered" it before you did.

> I checked
> Linux, FreeBSD and Solaris where this Problem does not accur. 

> find ///bin//// | head -1 ; uname
///bin////
FreeBSD
>

and

hell:elad {105} find ////bin/// | head -1 ; uname
////bin///
OpenBSD
hell:elad {106}

and

fatboy:~% find ///bin/// | head -1 ; uname
///bin///
SunOS
fatboy:~%

> Although some
> of you are fine with it, in it's current state, I am surely not. 

That's what open-source is all about: you can change it to fit *your*
needs!

> At least
> because it isn't compliant to other Unixes. 

I get the same behavior on NetBSD, OpenBSD, FreeBSD, and Solaris.

> And there is surely a POSIX Rule
> that says so aswell. 

Can you quote the POSIX "rule" that says so?

> I would appreciate a fix of find. 

I have a local program called zafer that also suffers from this bug.
Can you help me figure out a way to fix all userland programs that
are affected by this bug? here's the code for zafer:

phyre:tmp {249} cat zafer.c
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fts.h>

int main(int argc, char **argv) {
        FTS *f;
        FTSENT *e;

        f = fts_open(argv, 0, NULL);
        if (f == NULL)
                return (1);

        while ((e = fts_read(f)) != NULL)
                printf("%s\n", e->fts_path);

        fts_close(f);

        return (0);
}
phyre:tmp {250} gcc -o zafer zafer.c
phyre:tmp {251} ./zafer ////bin//// | tail -1
////bin////
phyre:tmp {252}

Thanks,

-e.

-- 
Elad Efrat
PGP Key ID: 0x666EB914