all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cyril Roelandt <tipecaml@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 3/5] gnu: Enable tests in Python 3.
Date: Sun, 23 Mar 2014 00:13:11 +0100	[thread overview]
Message-ID: <532E1907.3050907@gmail.com> (raw)
In-Reply-To: <87eh1v3d6p.fsf@gnu.org>

On 03/21/2014 02:15 PM, Ludovic Courtès wrote:
> Cyril Roelandt <tipecaml@gmail.com> skribis:
>
>> On 03/07/2014 10:40 AM, Ludovic Courtès wrote:
>>> Cyril Roelandt <tipecaml@gmail.com> skribis:
>
> [...]
>
>>>> +--- Lib/test/test_posixpath.py	2014-03-01 05:46:56.984311000 +0100
>>>> ++++ Lib/test/test_posixpath.py	2014-03-01 06:20:50.704311000 +0100
>>>> +@@ -319,7 +319,11 @@
>>>> +                 del env['HOME']
>>>> +                 home = pwd.getpwuid(os.getuid()).pw_dir
>>>> +                 # $HOME can end with a trailing /, so strip it (see #17809)
>>>> +-                self.assertEqual(posixpath.expanduser("~"), home.rstrip("/"))
>>>> ++		# The Guix builders have '/' as a home directory, so
>>>> ++		# home.rstrip("/") will be an empty string and the test will
>>>> ++		# fail. Let's just disable it since it does not really make
>>>> ++		# sense with such a bizarre setup.
>>>> ++                # self.assertEqual(posixpath.expanduser("~"), home.rstrip("/"))
>>>
>>> I see that the recipe’s ‘pre-check’ phase does:
>>>
>>>     (setenv "HOME" (getcwd))
>>>
>>> so $HOME should actually be /tmp/nix-build-xxx, not just /, no?
>>>
>>
>> Yes, but I think it uses getpwent() or something that does not use
>> $HOME to retrieve the home directory in this case.
>
> Here’s what I see, with nscd turned off (this uses getpwnam(2)):
>
> --8<---------------cut here---------------start------------->8---
> $ strace guile -c '(getpw "ludo")'
> [...]
> open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 5
> fstat(5, {st_mode=S_IFREG|0644, st_size=2072, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f264dea5000
> read(5, "root:x:0:0:System administrator:"..., 4096) = 2072
> --8<---------------cut here---------------end--------------->8---
>
> Normally the chroot environment has all that too.  And indeed, the
> equivalent of the above Python snippet seems to work:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> ,use(guix)
> scheme@(guile-user)> ,use(guix monads)
> scheme@(guile-user)> (define s (open-connection))
> scheme@(guile-user)> (derivation-expression "getpw" '(pk (getpw (getuid))))
> $11 = #<procedure 3da30f0 at guix/monads.scm:297:6 (store)>
> scheme@(guile-user)> (run-with-store s $11)
> $12 = #<derivation /gnu/store/bhmd5bg9s64an3s8ssmwx6l90dkr56hx-getpw.drv => /gnu/store/z68rzri3myxx1dg931fb1ksxdg7c29zg-getpw 33dfa00>
> scheme@(guile-user)> (build-derivations s (list $12))
> building path(s) `/gnu/store/z68rzri3myxx1dg931fb1ksxdg7c29zg-getpw'
>
> ;;; (#("nixbld" "x" 30001 30000 "Nix build user" "/" "/noshell"))

Am I misteading this, or is the home directory '/' for the nixbld user ? 
That's exactly what happens in Python (that uses getwpent). Hence the 
bug. I think skipping this assertion is the right thing to do here.

Cyril.

  reply	other threads:[~2014-03-22 23:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07  2:47 [PATCH 0/5] Python improvements Cyril Roelandt
2014-03-07  2:47 ` [PATCH 1/5] gnu: Enable the 'ctypes' module in Python Cyril Roelandt
2014-03-07  9:28   ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found Cyril Roelandt
2014-03-07  9:31   ` Ludovic Courtès
2014-03-22  3:36     ` [PATCH 2/4 v2] gnu: Python: use /nix/.../sh instead of /bin/sh in the subprocess module Cyril Roelandt
2014-03-22 14:26       ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 3/5] gnu: Enable tests in Python 3 Cyril Roelandt
2014-03-07  9:40   ` Ludovic Courtès
2014-03-21  4:12     ` [PATCH 3/4 v2] " Cyril Roelandt
2014-03-22 14:32       ` Ludovic Courtès
2014-03-21  4:14     ` [PATCH 3/5] " Cyril Roelandt
2014-03-21 13:15       ` Ludovic Courtès
2014-03-22 23:13         ` Cyril Roelandt [this message]
2014-03-23 10:43           ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 4/5] gnu: Python: bump to 3.3.4 Cyril Roelandt
2014-03-07  9:31   ` Ludovic Courtès
2014-03-21  4:07     ` Cyril Roelandt
2014-03-21 13:02       ` Ludovic Courtès
2014-03-07  2:47 ` [PATCH 5/5] gnu: remove python-fix-dbm.patch Cyril Roelandt
2014-03-07  9:32   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532E1907.3050907@gmail.com \
    --to=tipecaml@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.