Skip Menu |
Report information
Id: 127772
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: rob [at] hoelz.ro
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: mkdir($file) succeeds if $file exists and is a regular file
Download (untitled) / with headers
text/plain 317b
To reproduce: $ touch /tmp/my-fake-directory $ perl6 -e 'say ?mkdir("/tmp/my-fake-directory")' True I understand that we want to succeed in the common case that that directory already exists, but I'm wondering if that's the correct behavior and whether we should leave handling that case up to the user.
To: "Rob Hoelz (via RT)" <perl6-bugs-followup [...] perl.org>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Date: Wed, 23 Mar 2016 14:22:43 +0100
Subject: Re: [perl #127772] mkdir($file) succeeds if $file exists and is a regular file
Download (untitled) / with headers
text/plain 738b
Show quoted text
> On 23 Mar 2016, at 14:16, Rob Hoelz (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Rob Hoelz > # Please include the string: [perl #127772] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127772 > > > > To reproduce: > > $ touch /tmp/my-fake-directory > $ perl6 -e 'say ?mkdir("/tmp/my-fake-directory")' > True > > I understand that we want to succeed in the common case that that directory already exists, but I'm wondering if that's the correct behavior and whether we should leave handling that case up to the user.
FWIW, I think this is really a problem in the lower level nqp::mkdir() always returning True.
Subject: Re: [perl #127772] mkdir($file) succeeds if $file exists and is a regular file
CC: "Rob Hoelz (via RT)" <perl6-bugs-followup [...] perl.org>
To: Elizabeth Mattijsen <liz [...] dijkmat.nl>
From: Parrot Raiser <1parrota [...] gmail.com>
Date: Wed, 23 Mar 2016 12:19:58 -0400
Download (untitled) / with headers
text/plain 1.2k
If a name's already in use, what's the right response to an attempt to over-write it? For a regular file, if it's write-enabled, doing so might be the right response, since that's consistent with the current behaviour. For a directory, attempting to re-use an existing name is more likely to be an error, regardless of the nature of the named file. In that case it should fail, and indicate that it has done so. On 3/23/16, Elizabeth Mattijsen <liz@dijkmat.nl> wrote: Show quoted text
>
>> On 23 Mar 2016, at 14:16, Rob Hoelz (via RT) >> <perl6-bugs-followup@perl.org> wrote: >> >> # New Ticket Created by Rob Hoelz >> # Please include the string: [perl #127772] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=127772 > >> >> >> To reproduce: >> >> $ touch /tmp/my-fake-directory >> $ perl6 -e 'say ?mkdir("/tmp/my-fake-directory")' >> True >> >> I understand that we want to succeed in the common case that that >> directory already exists, but I'm wondering if that's the correct behavior >> and whether we should leave handling that case up to the user.
> > FWIW, I think this is really a problem in the lower level nqp::mkdir() > always returning True.
Download (untitled) / with headers
text/plain 1.7k
On 2016-03-23 09:20:42, 1parrota@gmail.com wrote: Show quoted text
> If a name's already in use, what's the right response to an attempt to > over-write it?
Personally, I think we should propagate this error to the user and let them handle it. Show quoted text
> For a regular file, if it's write-enabled, doing so might be the right > response, since that's consistent with the current behaviour.
Let's say I have a regular file, "output.log", which has a lot of useful information, and I try to mkdir("output.log"). If it blows away the file in order to make output.log into a directory, I would consider that seriously LTA. While I think that trying to be convenient to the user is a good thing, I think offering too much convenience to the user can do more harm than help. Show quoted text
> For a directory, attempting to re-use an existing name is more likely > to be an error, regardless of the nature of the named file. In that > case it should fail, and indicate that it has done so. > > On 3/23/16, Elizabeth Mattijsen <liz@dijkmat.nl> wrote:
> >
> >> On 23 Mar 2016, at 14:16, Rob Hoelz (via RT) > >> <perl6-bugs-followup@perl.org> wrote: > >> > >> # New Ticket Created by Rob Hoelz > >> # Please include the string: [perl #127772] > >> # in the subject line of all future correspondence about this issue. > >> # <URL: https://rt.perl.org/Ticket/Display.html?id=127772 > > >> > >> > >> To reproduce: > >> > >> $ touch /tmp/my-fake-directory > >> $ perl6 -e 'say ?mkdir("/tmp/my-fake-directory")' > >> True > >> > >> I understand that we want to succeed in the common case that that > >> directory already exists, but I'm wondering if that's the correct > >> behavior > >> and whether we should leave handling that case up to the user.
> > > > FWIW, I think this is really a problem in the lower level > > nqp::mkdir() > > always returning True.
Download (untitled) / with headers
text/plain 315b
I'd like to see the same behavior that occurs in perl5. That is: DB<3> mkdir "existingfile" or warn "$!\n" File exists DB<4> mkdir "/" or warn "$!\n" File exists DB<5> mkdir "/root/noway" or warn "$!\n" Permission denied DB<6> mkdir "newdir" or warn "$!\n" DB<7> mkdir "newdir" or warn "$!\n" File exists


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org