Discussion:
fcgiwrap doesn't see gzip
(too old to reply)
Oleg Pykhalov
2017-12-01 12:48:56 UTC
Permalink
Raw Message
strace log from my previous message, apologies.

I guess, the issue is because fcgiwrap process environment PATH only
contains /gnu/store/
-shadow-4.5/sbin which doesn't include gzip.

--8<---------------cut here---------------start------------->8---
$ sudo strace -s 128 -p 457
strace: Process 457 attached
accept(0, {sa_family=AF_INET, sin_port=htons(57088), sin_addr=inet_addr("127.0.0.1")}, [112->16]) = 3
setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
read(3, "\1\1\0\1\0\10\0\0\0\1\0\0\0\0\0\0\1\4\0\1\1!\7\0\17FSCRIPT_FILENAME/gnu/store/27ki0l76vn23698caynfknbcnqf5jag0-cgit-1.1/lib/cgit/cgit.cgi\t&PATH_INFO/guix/"..., 8192) = 336
pipe([4, 5]) = 0
pipe([6, 7]) = 0
pipe([8, 9]) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff3f0dc4e10) = 12762
close(4) = 0
close(7) = 0
close(9) = 0
close(5) = 0
select(9, [6 8], NULL, NULL, NULL) = 1 (in [8])
read(8, "[cgit] Unable to lock slot /var/cache/cgit/8a300000.lock: Permission denied (13)\n", 4096) = 81
write(2, "[cgit] Unable to lock slot /var/cache/cgit/8a300000.lock: Permission denied (13)\n", 81) = 81
select(9, [6 8], NULL, NULL, NULL) = 1 (in [6])
read(6, "Content-Type: application/x-gzip; charset=UTF-8\nContent-Disposition: inline; filename=\"guix-0.13.0.tar.gz\"\n", 4096) = 107
select(9, [6 8], NULL, NULL, NULL) = 1 (in [6])
read(6, "Last-Modified: Fri, 01 Dec 2017 11:42:10 GMT\nExpires: Fri, 01 Dec 2017 11:47:10 GMT\nETag: \"99d1ec5989eae66719fb968f41560f2879707"..., 4096) = 134
select(9, [6 8], NULL, NULL, NULL) = 1 (in [8])
read(8, "fatal: Unable to exec subprocess gzip: No such file or directory\n", 4096) = 65
write(2, "fatal: Unable to exec subprocess gzip: No such file or directory\n", 65) = 65
select(9, [6 8], NULL, NULL, NULL) = 2 (in [6 8])
read(6, "", 4096) = 0
close(6) = 0
read(8, "", 4096) = 0
close(8) = 0
write(3, "\1\6\0\1\0\367\1\0Content-Type: application/x-gzip; charset=UTF-8\r\nContent-Disposition: inline; filename=\"guix-0.13.0.tar.gz\"\r\nLast-Modifi"..., 280) = 280
shutdown(3, SHUT_WR) = 0
poll([{fd=3, events=POLLIN}], 1, 2000) = 1 ([{fd=3, revents=POLLIN|POLLHUP}])
read(3, "", 1024) = 0
close(3) = 0
accept(0, C-c C-cstrace: Process 457 detached
<detached ...>
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
/proc/457$ sudo cat environ
HOME=/
TERM=linux
BOOT_IMAGE=/gnu/store/nrhx7jf33zqxmbw832bpxyrnc0k3lrnq-linux-libre-4.14.2/bzImage --root=magnolia-root --system=/gnu/store/mqwc1vmlnx076aka7gn8bi89hmj6v3pq-system --load=/gnu/store/mqwc1vmlnx076aka7gn8bi89hmj6v3pq-system/boot
PATH=/gnu/store/a8arlhcrf70113zw7b3qrwqbqfq2hgj6-shadow-4.5/sbin
--8<---------------cut here---------------end--------------->8---

Thanks,
Oleg.
Oleg Pykhalov
2017-12-01 11:49:16 UTC
Permalink
Raw Message
Hello Guix, cgit service through fcgiwrap doesn't see gzip.

/run/current-system/profile/bin/gzip exists.

fcgiwrap strace: http://paste.debian.net/998501
Ludovic Courtès
2017-12-04 09:04:14 UTC
Permalink
Raw Message
Hi Oleg,

Oleg Pykhalov <***@gmail.com> skribis:

> strace log from my previous message, apologies.
>
> I guess, the issue is because fcgiwrap process environment PATH only
> contains /gnu/store/…-shadow-4.5/sbin which doesn't include gzip.

There are two possible fixes:

1. Set PATH in the execution environment of ‘fcgiwrap’, just like the
‘mcron-shepherd-services’ procedure does;

2. Add a build phase for ‘fcgiwrap’ that ensures that it refers to
‘gzip’ by its absolute file name.

I have a preference for #2 because it’s more robust.

Could you look into it?

Thanks,
Ludo’.
Oleg Pykhalov
2017-12-12 15:41:53 UTC
Permalink
Raw Message
Hello Ludovic,

Thank you for directing me.

***@gnu.org (Ludovic CourtÚs) writes:

>> I guess, the issue is because fcgiwrap process environment PATH only
>> contains /gnu/store/
-shadow-4.5/sbin which doesn't include gzip.
>
> There are two possible fixes:
>
> 1. Set PATH in the execution environment of ‘fcgiwrap’, just like the
> ‘mcron-shepherd-services’ procedure does;
>
> 2. Add a build phase for ‘fcgiwrap’ that ensures that it refers to
> ‘gzip’ by its absolute file name.
>
> I have a preference for #2 because it’s more robust.
>
> Could you look into it?

Yes, but I solve this via cgit package. I believe it's good enough. :-)
Ludovic Courtès
2017-12-12 16:09:58 UTC
Permalink
Raw Message
Hello,

Oleg Pykhalov <***@gmail.com> skribis:

> ***@gnu.org (Ludovic Courtès) writes:
>
>>> I guess, the issue is because fcgiwrap process environment PATH only
>>> contains /gnu/store/…-shadow-4.5/sbin which doesn't include gzip.
>>
>> There are two possible fixes:
>>
>> 1. Set PATH in the execution environment of ‘fcgiwrap’, just like the
>> ‘mcron-shepherd-services’ procedure does;
>>
>> 2. Add a build phase for ‘fcgiwrap’ that ensures that it refers to
>> ‘gzip’ by its absolute file name.
>>
>> I have a preference for #2 because it’s more robust.
>>
>> Could you look into it?
>
> Yes, but I solve this via cgit package. I believe it's good enough. :-)

Good!

> From 9c9ad2a3716b7ad97e80028e0424f3af6c3759a6 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <***@gmail.com>
> Date: Tue, 12 Dec 2017 18:29:23 +0300
> Subject: [PATCH] gnu: cgit: Patch absolute file names.
>
> * gnu/packages/version-control.scm (cgit): Patch absolute file names.

[...]

> + (lambda* (#:key inputs #:allow-other-keys)
> + (define (quoted-path input path)
> + (string-append "\"" input path "\""))
> + (substitute* "ui-snapshot.c"
> + (("\"gzip\"")
> + (quoted-path (assoc-ref %build-inputs "gzip")
> + "/bin/gzip"))
> + (("\"bzip2\"")
> + (quoted-path (assoc-ref %build-inputs "bzip2")
> + "/bin/bzip2"))
> + (("\"xz\"")
> + (quoted-path (assoc-ref %build-inputs "xz")
> + "/bin/xz")))

Use ‘inputs’ instead of ‘%build-inputs’ (it’s equivalent but IMO
clearer.)

Also I’d suggest “quoted-file-name” or just “quoted” instead of
“quoted-path”. :-)

OK with changes along these lines, thank you!

Ludo’.
Oleg Pykhalov
2017-12-13 02:20:47 UTC
Permalink
Raw Message
Hello Ludovic,

***@gnu.org (Ludovic CourtÚs) writes:

[...]

>> + (lambda* (#:key inputs #:allow-other-keys)
>> + (define (quoted-path input path)
>> + (string-append "\"" input path "\""))
>> + (substitute* "ui-snapshot.c"
>> + (("\"gzip\"")
>> + (quoted-path (assoc-ref %build-inputs "gzip")
>> + "/bin/gzip"))
>> + (("\"bzip2\"")
>> + (quoted-path (assoc-ref %build-inputs "bzip2")
>> + "/bin/bzip2"))
>> + (("\"xz\"")
>> + (quoted-path (assoc-ref %build-inputs "xz")
>> + "/bin/xz")))
>
> Use ‘inputs’ instead of ‘%build-inputs’ (it’s equivalent but IMO
> clearer.)
>
> Also I’d suggest “quoted-file-name” or just “quoted” instead of
> “quoted-path”. :-)

OK, thanks.

> OK with changes along these lines, thank you!

Pushed as 91b21ba9f712bce033b717422c3d2022ffe8a70a

Oleg.
Loading...