2 files, same name, same dir

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

2 files, same name, same dir

alan01346
This is in 5.7 but I don't understand how it could happen (and I never
noticed it before).  Two files in the same directory with the same
name, different owners.  Last night I was noticing that my edits to my
program sometimes weren't taking effect, this seems to be why.  Ideas?
 I can delete the wrong one from mc probably, I just wanted to mention
it.

-rw-r--r--    1 alan  wheel    25549 Oct 22 10:55 pi.c
-rw-r--r--    1 root  wheel    25152 Oct 22 00:07 pi.c
freebie# whoami
root


--
Credit is the root of all evil.  - AB1JX

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

Jeremie Courreges-Anglas-2
Alan Corey <[hidden email]> writes:

> This is in 5.7

Boo.

> but I don't understand how it could happen (and I never
> noticed it before).  Two files in the same directory with the same
> name, different owners.  Last night I was noticing that my edits to my
> program sometimes weren't taking effect, this seems to be why.  Ideas?
>  I can delete the wrong one from mc probably, I just wanted to mention
> it.
>
> -rw-r--r--    1 alan  wheel    25549 Oct 22 10:55 pi.c
> -rw-r--r--    1 root  wheel    25152 Oct 22 00:07 pi.c
> freebie# whoami
> root

Are you sure that the names are exactly the same?  env LC_ALL=C ls,
hexdump, etc

--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

Otto Moerbeek
In reply to this post by alan01346
On Sat, Oct 22, 2016 at 11:08:47AM -0400, Alan Corey wrote:

> This is in 5.7 but I don't understand how it could happen (and I never
> noticed it before).  Two files in the same directory with the same
> name, different owners.  Last night I was noticing that my edits to my
> program sometimes weren't taking effect, this seems to be why.  Ideas?
>  I can delete the wrong one from mc probably, I just wanted to mention
> it.
>
> -rw-r--r--    1 alan  wheel    25549 Oct 22 10:55 pi.c
> -rw-r--r--    1 root  wheel    25152 Oct 22 00:07 pi.c
> freebie# whoami
> root
>
>
> --
> Credit is the root of all evil.  - AB1JX

Likely one of them has  space or so in it's name. Use  

$ ls -l | vis -l

or some variation.

        -Otto

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

alan01346
Bingo, a trailing space.  I would have thought that would get trimmed
off somehow.  I don't normally put spaces in filenames, I must have
fat-fingered something.  But I see no reason to keep trailing spaces.

-rw-r--r--  1 alan  wheel    25549 Oct 22 10:55 pi.c\$
-rw-r--r--  1 root  wheel    25152 Oct 22 00:07 pi.c \$

> Likely one of them has  space or so in it's name. Use
>
> $ ls -l | vis -l
>
> or some variation.
>
> -Otto
>


--
Credit is the root of all evil.  - AB1JX

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

Nick Holland
On 10/22/16 11:26, Alan Corey wrote:
> Bingo, a trailing space.  I would have thought that would get trimmed
> off somehow.  I don't normally put spaces in filenames, I must have
> fat-fingered something.  But I see no reason to keep trailing spaces.

um. Unix.

File names can have almost any character, and they are all equally valid
in all places in the file name.  This ain't CP/M or its derivatives
(like Windows).

(and it wouldn't surprise me if Linux "saves" you from this error, and
it would just make me hate it all the more)

Nick.



>
> -rw-r--r--  1 alan  wheel    25549 Oct 22 10:55 pi.c\$
> -rw-r--r--  1 root  wheel    25152 Oct 22 00:07 pi.c \$
>
>> Likely one of them has  space or so in it's name. Use
>>
>> $ ls -l | vis -l
>>
>> or some variation.
>>
>> -Otto

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

alan01346
In reply to this post by alan01346
I can probably blame it on the Joe editor, which leaves trailing
spaces on lines in files too.  I wrote a program once to strip them
off, probably doesn't bother anybody else.  When you save a file it
prompts with a (previous) filename with the cursor at the end, bumping
the spacebar then would do it, I've hit other characters by accident
and had those end up in filenames.  I've been using Joe for ~20 years.

But a trailing space on a filename, after the extension, is pointless
to keep.  Probably featureitis to build in looking for them though.

On 10/22/16, Alan Corey <[hidden email]> wrote:
> Bingo, a trailing space.  I would have thought that would get trimmed
> off somehow.  I don't normally put spaces in filenames, I must have
> fat-fingered something.  But I see no reason to keep trailing spaces.
>
> -rw-r--r--  1 alan  wheel    25549 Oct 22 10:55 pi.c\$
> -rw-r--r--  1 root  wheel    25152 Oct 22 00:07 pi.c \$

Reply | Threaded
Open this post in threaded view
|

Re: 2 files, same name, same dir

Kamil Cholewiński
In reply to this post by Nick Holland
On Sat, 22 Oct 2016, Nick Holland <[hidden email]> wrote:
> (and it wouldn't surprise me if Linux "saves" you from this error, and
> it would just make me hate it all the more)

No need to kick the poor penguin...

> $ uname
> Linux
> $ mkdir /tmp/test
> $ cd $_
> $ touch "pi.c"
> $ touch "pi.c "
> $ ls | hexdump -C    
> 00000000  70 69 2e 63 0a 70 69 2e  63 20 0a                 |pi.c.pi.c .|
> 0000000b