develooper Front page | perl.perl5.porters | Postings from January 2018

Re: [perl #132648] Cwd: different return values between pure perland XS variants

Thread Previous | Thread Next
From:
Tony Cook
Date:
January 16, 2018 05:30
Subject:
Re: [perl #132648] Cwd: different return values between pure perland XS variants
Message ID:
20180116052952.uf63am3sakfawyfi@mars.tony.develop-help.com
On Mon, Jan 15, 2018 at 11:28:06PM +0000, Zefram wrote:
> Tony Cook wrote:
> >#   Failed test 'regular getcwd result on non-existent directory'
> >#   at t/cwd_enoent.t line 30.
> >#          got: '/tmp/4WuHD3C4IY/testdir'
> >#     expected: undef
> 
> For getcwd() to yield a non-error return for a non-existent directory
> seems like a bug.  Cygwin seems to prefer _backtick_pwd() as its
> implementation of getcwd(), so maybe this is a bug in Cygwin's pwd(1).
> Would someone on Cygwin please check, firstly, whether pwd(1) actually
> exhibits this behaviour for a removed directory, and secondly, whether
> the removed directory can actually be addressed by this name.  (If it
> can be addressed by name, that would seem to be a bug in rmdir().)

I tested with:

tony@saturn ~/dev/perl/git
$ cat 132648.c
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>

int main(void) {
  char buf[1000]; /* keeping this simple */
  if (mkdir("foo", 0700) < 0) {
    perror("mkdir");
    return 1;
  }
  if (chdir("foo") < 0) {
    perror("chdir");
    return 1;
  }
  if (rmdir("../foo") < 0) {
    perror("rmdir");
    return 1;
  }

  if (!getcwd(buf, sizeof(buf))) {
    perror("getcwd");
    return 1;
  }
  puts(buf);

  return 0;
}

tony@saturn ~/dev/perl/git
$ cc -o132648.exe 132648.c

tony@saturn ~/dev/perl/git
$ ./132648
/home/tony/dev/perl/git/foo

I've asked about it on the cygwin mailing list.

I suspect this will be WONTFIX at the cygwin level.

Tony

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About