Re: cp(1) bug ?

2007-10-22 Thread ropers
On 22 Oct 2007 01:30:57 +0200, Artur Grabowski [EMAIL PROTECTED] wrote: Tom Van Looy [EMAIL PROTECTED] writes: on unix everything is a file? s/unix/Plan 9/g http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs no, it's not. It's the dumbed down truth so that you can explain to random people

Re: cp(1) bug ?

2007-10-21 Thread Artur Grabowski
Tom Van Looy [EMAIL PROTECTED] writes: on unix everything is a file? no, it's not. It's the dumbed down truth so that you can explain to random people what the hell Unix is, or rather to make them have a dumb look on their face and nod. A process is not a file, a memory region is not a file,

Re: cp(1) bug ?

2007-10-20 Thread Andreas Kahari
On 20/10/2007, Aaron W. Hsu [EMAIL PROTECTED] wrote: From: Tom Van Looy [EMAIL PROTECTED] Date: Fri, 19 Oct 2007 20:21:56 + Subject: Re: cp(1) bug ? it shall do nothing more with source_file and shall go on to any remaining files. Doesn't this mean that cp should not do anything

Re: cp(1) bug ?

2007-10-20 Thread Tom Van Looy
on unix everything is a file? - Oorspronkelijk bericht - Van: Ted Unangst [mailto:[EMAIL PROTECTED] Verzonden: zaterdag, oktober 20, 2007 01:18 AM Aan: 'Aaron W. Hsu' CC: [EMAIL PROTECTED], misc@openbsd.org Onderwerp: Re: cp(1) bug ? On 10/19/07, Aaron W. Hsu [EMAIL PROTECTED] wrote

Re: cp(1) bug ?

2007-10-20 Thread RW
On Sat, 20 Oct 2007 09:59:26 +, Tom Van Looy wrote: on unix everything is a file? Always has been. At least as far back as I can remember - about early 1978. Probably always will. And, given the thread running here, my second edition of the Unix Programmers Manual vol 1 from those days

Re: cp(1) bug ?

2007-10-20 Thread Paul de Weerd
, oktober 20, 2007 01:18 AM | Aan: 'Aaron W. Hsu' | CC: [EMAIL PROTECTED], misc@openbsd.org | Onderwerp: Re: cp(1) bug ? | | On 10/19/07, Aaron W. Hsu [EMAIL PROTECTED] wrote: | From: Tom Van Looy [EMAIL PROTECTED] | Date: Fri, 19 Oct 2007 20:21:56 + | Subject: Re: cp(1) bug

Re: cp(1) bug ?

2007-10-20 Thread a.padilla
PROTECTED], misc@openbsd.org Onderwerp: Re: cp(1) bug ? On 10/19/07, Aaron W. Hsu [EMAIL PROTECTED] wrote: From: Tom Van Looy [EMAIL PROTECTED] Date: Fri, 19 Oct 2007 20:21:56 + Subject: Re: cp(1) bug ? it shall do nothing more with source_file and shall go on to any remaining files

Re: cp(1) bug ?

2007-10-20 Thread Ted Unangst
On 10/18/07, Richard Toohey [EMAIL PROTECTED] wrote: # diff -u /tmp/cp.c cp.c --- /tmp/cp.c Thu Oct 18 21:50:07 2007 +++ cp.cThu Oct 18 22:48:37 2007 @@ -237,6 +237,10 @@ */ type = FILE_TO_DIR; + if (type == FILE_TO_DIR) + if

Re: cp(1) bug ?

2007-10-20 Thread Ted Unangst
On 10/19/07, Gregg Reynolds [EMAIL PROTECTED] wrote: On 10/19/07, Ted Unangst [EMAIL PROTECTED] wrote: no, because that section is talking about files, not directories. A directory is a kind of file: file An object that can be written to, or read from, or both. A file has certain

Re: : cp(1) bug ?

2007-10-19 Thread Raimo Niskanen
On Thu, Oct 18, 2007 at 10:06:42PM +1300, Richard Toohey wrote: This looks like fun ... 8-) And this is open source, so let's follow the code and learn something as we go along ... But first, I guess it IS following your instructions ... You asked it to copy what's in directory foo,

Re: : cp(1) bug ?

2007-10-19 Thread Richard Toohey
On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote: On Thu, Oct 18, 2007 at 10:06:42PM +1300, Richard Toohey wrote: JUST FOR FUN I have tried to fix this. What I know about C code can be written on the back of a postage stamp Did I mention the SIZE of the postage stamp? It's rather small ...

Re: : cp(1) bug ?

2007-10-19 Thread Rodrigo V. Raimundo
Em Sex, 2007-10-19 C s 13:52 -0400, Douglas A. Tutty escreveu: On Fri, Oct 19, 2007 at 09:19:21AM -0400, Nick Guenther wrote: On 10/19/07, Tom Van Looy [EMAIL PROTECTED] wrote: Richard Toohey wrote: On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote: Looks like OpenBSD, FreeBSD, and

Re: cp(1) bug ?

2007-10-19 Thread Rémi Bougard
Hello, On Fri, Oct 19, 2007 at 07:59:38PM +0200, ropers wrote: [...] pdksh on Linux behaves just like bash on Linux, and unlike pdksh on OpenBSD. I didn't expect that. So does that error message depend on OS APIs rather than the shell program and its built-in commands? cp is part of the

Re: cp(1) bug ?

2007-10-19 Thread ropers
On 19/10/2007, ropers [EMAIL PROTECTED] wrote: I beat you to trying it on Linux No I didn't. Others beat me and you to it. Apologies for the unnecessary noise. (...) IMHO cp behaving like this is somewhat nicer than its current behaviour on apparently most or all BSD OSes. I'm surprised

Re: cp(1) bug ?

2007-10-19 Thread Ted Unangst
On 10/19/07, Rimi Bougard [EMAIL PROTECTED] wrote: Hello, On Fri, Oct 19, 2007 at 07:59:38PM +0200, ropers wrote: [...] pdksh on Linux behaves just like bash on Linux, and unlike pdksh on OpenBSD. I didn't expect that. So does that error message depend on OS APIs rather than the shell

Re: cp(1) bug ?

2007-10-19 Thread Tom Van Looy
I read that single unix specification thing again because the OpenBSD cp manpage says it is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. quote For each source_file, the following steps shall be taken: 1) If source_file references the same file as dest_file, cp may write a

Re: cp(1) bug ?

2007-10-19 Thread ropers
On 19/10/2007, ropers [EMAIL PROTECTED] wrote: I'm surprised now. I just thought that what I wrote above was stupid, because I thought that the behaviour of cp was a function of the shell built-in command cp, not of the OS. To confirm this, I installed the OpenBSD default shell pdksh on

Re: cp(1) bug ?

2007-10-19 Thread Ted Unangst
On 10/19/07, Aaron W. Hsu [EMAIL PROTECTED] wrote: From: Tom Van Looy [EMAIL PROTECTED] Date: Fri, 19 Oct 2007 20:21:56 + Subject: Re: cp(1) bug ? it shall do nothing more with source_file and shall go on to any remaining files. Doesn't this mean that cp should not do anything

Re: cp(1) bug ?

2007-10-19 Thread Gregg Reynolds
On 10/19/07, Ted Unangst [EMAIL PROTECTED] wrote: On 10/19/07, Aaron W. Hsu [EMAIL PROTECTED] wrote: From: Tom Van Looy [EMAIL PROTECTED] Date: Fri, 19 Oct 2007 20:21:56 + Subject: Re: cp(1) bug ? it shall do nothing more with source_file and shall go on to any remaining

Re: cp(1) bug ?

2007-10-19 Thread ropers
On 19/10/2007, Andreas Kahari [EMAIL PROTECTED] wrote: On 19/10/2007, ropers [EMAIL PROTECTED] wrote: IMHO cp behaving like this is somewhat nicer than its current behaviour on apparently most or all BSD OSes. Then again, I STILL can't code, so I've no right to complain. ;o) Really?

Re: : cp(1) bug ?

2007-10-19 Thread Aaron W. Hsu
Date: Fri, 19 Oct 2007 20:12:26 +0200 From: Paul de Weerd [EMAIL PROTECTED] Subject: Re: : cp(1) bug ? On Fri, Oct 19, 2007 at 01:52:03PM -0400, Douglas A. Tutty wrote: | Conceptually, though, why can't cp look at the source directory and take a | snapshot, a to-do-list, of everything

Re: : cp(1) bug ?

2007-10-19 Thread Ted Unangst
On 10/19/07, Nick Guenther [EMAIL PROTECTED] wrote: On 10/19/07, Paul de Weerd [EMAIL PROTECTED] wrote: On Fri, Oct 19, 2007 at 01:52:03PM -0400, Douglas A. Tutty wrote: | Conceptually, though, why can't cp look at the source directory and take a | snapshot, a to-do-list, of everything it

Re: : cp(1) bug ?

2007-10-19 Thread Nick Guenther
On 10/19/07, Paul de Weerd [EMAIL PROTECTED] wrote: On Fri, Oct 19, 2007 at 01:52:03PM -0400, Douglas A. Tutty wrote: | Conceptually, though, why can't cp look at the source directory and take a | snapshot, a to-do-list, of everything it has to copy, then do it? That | way, any recursion

Re: : cp(1) bug ?

2007-10-19 Thread Douglas A. Tutty
On Fri, Oct 19, 2007 at 09:19:21AM -0400, Nick Guenther wrote: On 10/19/07, Tom Van Looy [EMAIL PROTECTED] wrote: Richard Toohey wrote: On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote: Looks like OpenBSD, FreeBSD, and Mac OS X BSD bits have the same sort of outcome. Copy foo

Re: : cp(1) bug ?

2007-10-19 Thread Rémi Bougard
On Fri, Oct 19, 2007 at 09:19:21AM -0400, Nick Guenther wrote: On 10/19/07, Tom Van Looy [EMAIL PROTECTED] wrote: [...] Anyway, it has worked like that since years, and I guess nobody has had a problem with it before. I don't think it should be changed just because some bored guy playing

Re: : cp(1) bug ?

2007-10-19 Thread Tom Van Looy
ps: it was a ;-p Nick Guenther wrote: On 10/19/07, Tom Van Looy [EMAIL PROTECTED] wrote: Richard Toohey wrote: On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote: Looks like OpenBSD, FreeBSD, and Mac OS X BSD bits have the same sort of outcome. Copy foo to foo only once and quit, I think

Re: cp(1) bug ?

2007-10-19 Thread Aaron W. Hsu
From: Tom Van Looy [EMAIL PROTECTED] Date: Fri, 19 Oct 2007 20:21:56 + Subject: Re: cp(1) bug ? it shall do nothing more with source_file and shall go on to any remaining files. Doesn't this mean that cp should not do anything when, for example, the following command is run? $ cp

Re: cp(1) bug ?

2007-10-19 Thread Tom Van Looy
cp on linux is part of gnu coreutils (http://www.gnu.org/software/coreutils/) the error can be found in /coreutils-6.9/tests/cp/into-self So it is not a part of bash or ksh (also on OpenBSD it is not part of the shell, the code is in /usr/src/bin/cp/). I beat you to trying it on Linux No I

Re: : cp(1) bug ?

2007-10-19 Thread Paul de Weerd
On Fri, Oct 19, 2007 at 01:52:03PM -0400, Douglas A. Tutty wrote: | Conceptually, though, why can't cp look at the source directory and take a | snapshot, a to-do-list, of everything it has to copy, then do it? That | way, any recursion would be completed before the target directory | appeared in

Re: : cp(1) bug ?

2007-10-19 Thread Nick Guenther
On 10/19/07, Tom Van Looy [EMAIL PROTECTED] wrote: Richard Toohey wrote: On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote: Looks like OpenBSD, FreeBSD, and Mac OS X BSD bits have the same sort of outcome. Copy foo to foo only once and quit, I think that's the correct behaviour. I

Re: cp(1) bug ?

2007-10-19 Thread Andreas Kahari
On Debian, you also end up with a directory structure consisting of one new 'foo' directory within the original 'foo' directory, which is contradicting the message about not being able to copy foo into itself... $ mkdir foo $ touch foo/bar $ cp -R foo foo cp: cannot copy a directory, `foo', into

Re: cp(1) bug ?

2007-10-19 Thread Arnaud Berthomier
On the October 17, at 10:39 (-0700), Bryan Irvine wrote: [...] looks like a feature to me. ;) Agreed, although it does not seem to exists on GNU/Linux since GNU's cp is different from BSD's. The feature is present on {Net,Open,Free}BSD. It's not that a big deal, is it? Eventually, the

Re: cp(1) bug ?

2007-10-19 Thread ropers
On 19/10/2007, Edd Barrett [EMAIL PROTECTED] wrote: On 18/10/2007, Richard Toohey [EMAIL PROTECTED] wrote: $ mkdir foo $ cp -R foo foo Ill try this on a solaris box and a linix box tomorrow at work :P I beat you to trying it on Linux (Ubuntu Gutsy Gibbon 7.10): [EMAIL PROTECTED]:~$

Re: cp(1) bug ?

2007-10-19 Thread Pau Amaro-Seoane
penguin's behaviour: elachistos| cp -R foo foo cp: cannot copy a directory, `foo', into itself, `foo/foo' :) 2007/10/19, Arnaud Berthomier [EMAIL PROTECTED]: On the October 17, at 10:39 (-0700), Bryan Irvine wrote: [...] looks like a feature to me. ;) Agreed, although it does not seem

Re: : cp(1) bug ?

2007-10-19 Thread Tom Van Looy
correction: hard links are not allowed on directory's, ... that being said, comparing inodes seems the best solution only, don't give an error but copy once maybe if I have time this weekend I'll try code that behaviour Anyway, it has worked like that since years, and I guess nobody has had a

Re: cp(1) bug ?

2007-10-18 Thread Richard Toohey
This looks like fun ... 8-) And this is open source, so let's follow the code and learn something as we go along ... But first, I guess it IS following your instructions ... You asked it to copy what's in directory foo, recursively. And you are changing what's in foo at the same time ... 1.

Re: cp(1) bug ?

2007-10-18 Thread Ben Goren
On 2007 Oct 18, at 4:40 PM, Edd Barrett wrote: On 18/10/2007, Richard Toohey [EMAIL PROTECTED] wrote: $ mkdir foo $ cp -R foo foo Ill try this on a solaris box and a linix box tomorrow at work :P Mac OS X 10.4 behaves exactly the same way as OpenBSD does. Cheers, b [demime 1.01d

Re: cp(1) bug ?

2007-10-18 Thread Nick Guenther
On 10/18/07, Edd Barrett [EMAIL PROTECTED] wrote: On 18/10/2007, Richard Toohey [EMAIL PROTECTED] wrote: $ mkdir foo $ cp -R foo foo Ill try this on a solaris box and a linix box tomorrow at work :P For what's it's worth, this is what OS X decides: Axkbk:~ kousu$ mkdir test Axkbk:~

Re: cp(1) bug ?

2007-10-18 Thread Edd Barrett
On 18/10/2007, Richard Toohey [EMAIL PROTECTED] wrote: $ mkdir foo $ cp -R foo foo Ill try this on a solaris box and a linix box tomorrow at work :P -- Best Regards Edd --- http://students.dec.bournemouth.ac.uk/ebarrett

cp(1) bug ?

2007-10-17 Thread Rémi Bougard
Hello everyboddy, I have a (probably) stupid question... Please forgive me if she really is. I discovered today a strange thing: $ mkdir foo $ cp -R foo foo I was waiting something like cannot copy a directory into himself or something like that but in fact this command create a (infinite ?

Re: cp(1) bug ?

2007-10-17 Thread Bryan Irvine
On 10/17/07, Rimi Bougard [EMAIL PROTECTED] wrote: Hello everyboddy, I have a (probably) stupid question... Please forgive me if she really is. I discovered today a strange thing: $ mkdir foo $ cp -R foo foo I was waiting something like cannot copy a directory into himself or