Bug 1839007 - mpich fails in mock with gethostbyname failed
Summary: mpich fails in mock with gethostbyname failed
Alias: None
Product: Fedora
Classification: Fedora
Component: mpich
Version: 31
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2020-05-22 10:18 UTC by david08741
Modified: 2020-10-10 10:00 UTC (History)
10 users (show)

Fixed In Version: mpich-3.3.2-8.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-09-25 16:58:57 UTC
Type: Bug

Attachments (Terms of Use)
example of failing spec (856 bytes, text/plain)
2020-05-22 10:18 UTC, david08741
no flags Details

Description david08741 2020-05-22 10:18:35 UTC
Created attachment 1691014 [details]
example of failing spec

Description of problem:
mock fails with network disabled, if trying to resolve the local hostname.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
0. Get attached test.spec
1. rpmbuild -bs test.spec
2. mock ../SRPMS/test-2.10-1.fc30.src.rpm  --root=fedora-33-x86_64

a0. compile mpich program in mock
a1. mpirun program

Actual results:
resolve local hostname fails

Expected results:
program should run and exit without error

Additional info:
This is especially annoying as this causing failures in copr.

A workaround is to enable network, but that shouldn't be required.

Comment 1 Pavel Raiskup 2020-08-28 06:56:21 UTC
Weird, I tested gethostbyname in mock, and it seems to work
even in default systemd-nspawn (--isolation=simple is work-around).

<mock-chroot> sh-5.0# cat ~/test.c 
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>

int main(int argc, char **argv)
        char *hostname = argv[1];
        struct hostent* h = gethostbyname(hostname);
        char ip[1000];
        inet_ntop(h->h_addrtype, h->h_addr_list[0], ip, 1000);
        printf("IP of %s is %s\n", hostname, ip);
<mock-chroot> sh-5.0# gcc ~/test.c
<mock-chroot> sh-5.0# ./a.out localhost
IP of localhost is
<mock-chroot> sh-5.0# ./a.out f3c93d2243464e9cb0ff764809b4b681
IP of f3c93d2243464e9cb0ff764809b4b681 is

It seems mpich is doing something else?  What I think isn't correct
is to expect that there's a DNS server doing the translation inside
mock.  There are no servers available.

Comment 2 Zbigniew Jędrzejewski-Szmek 2020-09-15 14:09:32 UTC

Comment 3 Fedora Update System 2020-09-15 15:35:20 UTC
FEDORA-2020-d5c4564da8 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-d5c4564da8

Comment 4 Zbigniew Jędrzejewski-Szmek 2020-09-15 15:35:54 UTC
I pushed the update to F33+. Let me know if you need this in lower versions.

Comment 5 Fedora Update System 2020-09-16 18:56:58 UTC
FEDORA-2020-d5c4564da8 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-d5c4564da8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-d5c4564da8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2020-09-25 16:58:57 UTC
FEDORA-2020-d5c4564da8 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 david08741 2020-10-10 09:54:49 UTC
Thanks for fixing. I am not sure what copr runs on, but if it gets fixed at some point, that works for me :-)

Comment 8 Zbigniew Jędrzejewski-Szmek 2020-10-10 10:00:46 UTC
It doesn't matter what copr runs *on*. This package is installed in the build root *inside*
of copr. The patch is currently in F33 as mentioned above, so F33 build roots should be
fixed, but lower ones not.

Note You need to log in before you can comment on or make changes to this bug.