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

[perl #133534] PathTools: t/cwd_enoent.t fails in docker

From:
James E Keenan via RT
Date:
October 11, 2018 23:20
Subject:
[perl #133534] PathTools: t/cwd_enoent.t fails in docker
Message ID:
rt-4.0.24-9667-1539300011-209.133534-15-0@perl.org
On Thu, 04 Oct 2018 21:10:43 GMT, slaven@rezic.de wrote:
> "James E Keenan via RT" <perlbug-followup@perl.org> writes:
> 
> > On Thu, 04 Oct 2018 19:28:02 GMT, slaven@rezic.de wrote:
> >> Dana Thu, 04 Oct 2018 11:57:43 -0700, jkeenan@pobox.com reče:
> >> > On 10/04/2018 05:25 AM, slaven@rezic.de via RT wrote:
> >> > > Dana Wed, 03 Oct 2018 07:21:15 -0700, jkeenan reče:
> >> > >> On Tue, 02 Oct 2018 13:43:10 GMT, slaven@rezic.de wrote:
> >> > >>> Dana Thu, 20 Sep 2018 07:10:47 -0700, slaven@rezic.de reče:
> >> > >>>>
> >> > >>>> This is a bug report for perl from slaven@rezic.de,
> >> > >>>> generated with the help of perlbug 1.40 running under perl
> >> > >>>> 5.20.2.
> >> > >>>>
> >> > >>>>
> >> > >>>> -----------------------------------------------------------------
> >> > >>>> t/cwd_enoent.t fails if run in a docker container:
> >> > >>>>
> >> > >>>> ...
> >> > >>>> #   Failed test 'perl getcwd errno on non-existent directory'
> >> > >>>> #   at t/cwd_enoent.t line 39.
> >> > >>>> #          got: '116'
> >> > >>>> #     expected: '2'
> >> > >>>>
> >> > >>>> #   Failed test 'perl abs_path errno on non-existent
> >> > >>>> directory'
> >> > >>>> #   at t/cwd_enoent.t line 44.
> >> > >>>> #          got: '116'
> >> > >>>> #     expected: '2'
> >> > >>>> # Looks like you failed 2 tests of 8.
> >> > >>>>   t/cwd_enoent.t .....
> >> > >>>> Dubious, test returned 2 (wstat 512, 0x200)
> >> > >>>>   Failed 2/8 subtests
> >> > >>>> ...
> >> > >>>>
> >> > >>>> It seems to fail also in other environments --- see
> >> > >>>> http://www.cpantesters.org/cpan/report/eeab8488-ac6c-11e8-
> >> > >>>> 8fb1-
> >> > >>>> ef5133556b3f
> >> > >>>> which looks like a NFS setup (but better ask Nigel Horne).
> >> > >>>>
> >> > >>>> In both cases stat(.) returns ESTALE instead of the expected
> >> > >>>> ENOENT.
> >> > >>>> Reproducible in an oneliner which has to be run in a docker
> >> > >>>> container:
> >> > >>>>
> >> > >>>> $ docker run -it ubuntu:bionic bash
> >> > >>>> $ apt-get update && apt-get install -y libautodie-perl
> >> > >>>> $ perl -Mautodie -e '$d = "/tmp/bla"; mkdir $d; chdir $d;
> >> > >>>> rmdir
> >> > >>>> $d;
> >> > >>>> stat(".") or warn $!'
> >> > >>>> Stale file handle at -e line 1.
> >> > >>>>
> >> > >>>> Maybe the test only needs slight adaption to accept both
> >> > >>>> errno
> >> > >>>> codes.
> >> > >>>>
> >> > >>>>> A possible patch is attached.
> >> > >>
> >> > >> I had to manually apply the patch because it was created
> >> > >> against
> >> > >> ./dist/PathTools rather than against . (the top of the core
> >> > >> distribution).
> >> > >
> >> > > Actually I did not report against perl5, but against the CPAN
> >> > > distribution PathTools, and did also the patch against the cpan
> >> > > dist.
> >> > > Unfortunately the issue tracker is the same for both.
> >> > >
> >> > >> Please check.  It's now available for smoking in this
> >> > >> branch:
> >> > >>
> >> > >> smoke-me/jkeenan/slaven/133534-path-tools
> >> > >>
> >> > >> Anyone who can test the branch inside a docker container,
> >> > >> please do
> >> > >> so.
> >> > >
> >> > > Here's a Dockerfile to test this. You can swap the git-clone
> >> > > commands
> >> > > to verify that blead fails on this test file.
> >> > >
> >> > > # docker build -t perl-test . && docker run perl-test
> >> > > FROM debian:stretch
> >> > > RUN echo "cache invalidation #1"
> >> > > RUN apt-get -y update
> >> > > RUN apt-get -y install build-essential git
> >> > > RUN echo "cache invalidation #1"
> >> > > WORKDIR /tmp
> >> > > RUN git clone --depth=1 --branch=smoke-me/jkeenan/slaven/133534-
> >> > > path-
> >> > > tools git://perl5.git.perl.org/perl.git
> >> > > #RUN git clone --depth=1 --branch=blead
> >> > > git://perl5.git.perl.org/perl.git
> >> > > WORKDIR /tmp/perl
> >> > > RUN ./configure.gnu -Dusedevel --prefix=/opt/perl
> >> > > RUN make -j4
> >> > > CMD ./perl -I. -MTestInit dist/PathTools/t/cwd_enoent.t
> >> > >
> >> > >
> >> > > ---
> >> > > via perlbug:  queue: perl5 status: open
> >> > > https://rt.perl.org/Ticket/Display.html?id=133534
> >> > >
> >> >
> >> > Is there anyone with both docker and a git checkout of blead who
> >> > could
> >> > test the above?
> >>
> >> Only docker needed. The Dockerfile cares for the git checkout
> >> itself.
> >>
> >>
> >
> > 1. General: Would it be possible to set up a reusable smoke-testing
> > rig for Docker?
> >
> 
> Probably. You just have to take care of docker's caching --- use it if
> it helps (e.g. when writing Dockerfiles from scratch) and invalidate
> it
> if it's needed (in the case above, the outcome of "git clone" would be
> cached which is probably not useful in a regular smoker setup).
> 
> > 2. Specific: I placed the text you posted in a file called Dockerfile
> > and then issued this command:
> >
> > #####
> > sudo docker build -t perl-test . && docker run perl-test
> > #####
> >
> > It appears to have built a container, built perl, but quit before
> > 'make test'.
> >
> > #####
> > Everything is up to date. Type 'make test' to run test suite.
> > Removing intermediate container 61fe4c1b8442
> > ---> 95eef459ead1
> > Step 11/11 : CMD ./perl -I. -MTestInit dist/PathTools/t/cwd_enoent.t
> > ---> Running in 3ab0b204f6de
> > Removing intermediate container 3ab0b204f6de
> > ---> c72bf919b01d
> > Successfully built c72bf919b01d
> > Successfully tagged perl-test:latest
> > docker: Got permission denied while trying to connect to the Docker
> > daemon socket at unix:///var/run/docker.sock: Post
> > http://%2Fvar%2Frun%2Fdocker.sock/v1.35/containers/create: dial unix
> > /var/run/docker.sock: connect: permission denied.
> > See 'docker run --help'.
> > #####
> >
> > What went wrong?  What do I do here?
> 
> The "docker run" command also needs sudo.
> 
> Or, for more convenience, you can add your unix user to the "docker"
> group, then calling sudo is not needed anymore.
> 
> Regards,
>     Slaven

Pushed to blead in commit commit 8508806268d1abe6c533393333ad151e12adfc2d.  Thanks to Mithaldu_ and Getty on #toolchain for getting this tested in a Docker environment.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133534



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