RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1803161 - nss_nis: Add conditional dependency on nss_nis.i686 to nss_nis.x86_64
Summary: nss_nis: Add conditional dependency on nss_nis.i686 to nss_nis.x86_64
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nss_nis
Version: 8.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: Filip Januš
QA Contact: RHEL CS Apps Subsystem QE
Lenka Špačková
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-14 15:11 UTC by Piyush Bhoot
Modified: 2023-09-07 21:52 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
.`getpwnam()` might fail when called by a 32-bit application When a user of NIS uses a 32-bit application that calls the `getpwnam()` function, the call fails if the `nss_nis.i686` package is missing. To work around this problem, manually install the missing package by using the `yum install nss_nis.i686` command.
Clone Of:
Environment:
Last Closed: 2020-12-16 11:22:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Piyush Bhoot 2020-02-14 15:11:45 UTC
Description of problem:
getpwnam call failing on 32 bit for NIS user

Version-Release number of selected component (if applicable):
glibc-2.28-72.el8_1.1.x86_64
RHEL 8

How reproducible:
Always


Steps to Reproduce:
1.

#define _POSIX_SOURCE
#include <pwd.h>
#include <stdio.h>
int main() {
    char *username = "nis1";
    struct passwd *p;

    printf("in getpwnam(\"%s\")\n", username);

    p = getpwnam((const char *)username);
    if( p )
    {
    printf("getpwnam() returned the following info for user %s:\n", username);
    printf("  pw_name  : %s\n",       p->pw_name);
    printf("  pw_uid   : %d\n", (int) p->pw_uid);
    printf("  pw_gid   : %d\n", (int) p->pw_gid);
    printf("  pw_dir   : %s\n",       p->pw_dir);
    printf("  pw_shell : %s\n",       p->pw_shell);
    }
    else
    {
        printf("out getpwnam() = IDCMD_FAILURE\n");
    }
  return 0;
}

2.
gcc -m32 hi.c -o a.ou
3.

Actual results:
./a.ou
in getpwnam("nis1")
out getpwnam() = IDCMD_FAILURE


Expected results:
./a.ou
in getpwnam("nis1")
getpwnam() returned the following info for user nis1:
  pw_name  : nis1
  pw_uid   : 10001
  pw_gid   : 10001
  pw_dir   : /home/nis1
  pw_shell : /bin/bash

Additional info:
Please note this works well when compiled without -m32

Comment 1 Florian Weimer 2020-02-14 15:19:19 UTC
Please make sure that the customer has actually installed nss_nis.i686.

Comment 3 Piyush Bhoot 2020-02-24 15:40:18 UTC
Customer has nss_nis-3.0-8.el8.i686 installed, 

Getting same error for LDAP user as well, what is being missed here?
# gcc hi.c -o a.out
./a.out
in getpwnam("testuser")
getpwnam() returned the following info for user testuser:
  pw_name  : testuser
  pw_uid   : 1100
  pw_gid   : 1100
  pw_dir   : /home/testuser
  pw_shell : /bin/bash
[root ~]# gcc -m32 hi.c -o a.out
[root ~]# ./a.out
in getpwnam("testuser")
out getpwnam() = IDCMD_FAILURE

Comment 6 Florian Weimer 2020-02-24 18:13:21 UTC
To avoid recurring issues with missing nss_nis.i686 packages, it nss_nis.x86_64 should have conditional dependency on the i686 package, like this:

%ifarch x86_64
Recommends: (nss_nis(x86-32) if glibc(x86-32))
%endif

This will also help with in-place upgrades from Red Hat Enterprise Linux 7.

It's not a perfect solution. I brought this up on the Fedora devel list: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3HZSIWSPEEC6KL6OBWSIPPYHU3CUL5YK/

Comment 9 Filip Januš 2020-05-12 13:33:09 UTC
Apologies, I made a mistake and I overlooked, that Florian's solution doesn't work. It looks like DNF skip self-dependency in field Recommends and doesn't support installation x86_64 together with i686. I tried to force it to install using Requires instead of Recommends but it leads to errors.

Comment 11 Florian Weimer 2020-05-14 15:06:33 UTC
(In reply to Filip Januš from comment #9)
> Apologies, I made a mistake and I overlooked, that Florian's solution
> doesn't work. It looks like DNF skip self-dependency in field Recommends and
> doesn't support installation x86_64 together with i686. I tried to force it
> to install using Requires instead of Recommends but it leads to errors.

Sorry, what exactly does not work? We are using something very similar for nss_db, and it works for us.

Comment 12 Filip Januš 2020-05-14 20:21:19 UTC
from your glibc spec:
%ifarch x86_64
# Automatically install the 32-bit variant if the 64-bit variant has
# been installed.  This covers the case when glibc.i686 is installed
# before nss_db.x86_64.  (See above for the other ordering.)
Recommends: (nss_db(x86-32) if glibc(x86-32))
%endif

if I perform following steps, nss_db.i686 won't be installed:

1. dnf install glibc.i686
2. for sure dnf install glibc-devel.i686
3. # rpm -qa |grep glibc
   glibc-headers-2.30-11.fc31.x86_64
   glibc-all-langpacks-2.30-11.fc31.x86_64
   glibc-devel-2.30-11.fc31.i686
   glibc-common-2.30-11.fc31.x86_64
   glibc-2.30-11.fc31.i686
   glibc-2.30-11.fc31.x86_64
   glibc-devel-2.30-11.fc31.x86_64


4.dnf install nss_db
   Dependencies resolved.
   ===================================================================================================================================================================
    Package                              Architecture                         Version                                     Repository                             Size
   ===================================================================================================================================================================
   Installing:
    nss_db                               x86_64                               2.30-11.fc31                                updates                                62 k

   Transaction Summary
   ===================================================================================================================================================================
   Install  1 Package

From my point of view here is missing nss_db.i686 as weak dependency. Maybe I have overlooked some important thing, but in my opinion, this construction "Recommends: (nss_db(x86-32) if glibc(x86-32))" is satisfied with glibc.i686 package.

Comment 13 Florian Weimer 2020-05-14 21:07:40 UTC
(In reply to Filip Januš from comment #12)
> from your glibc spec:
> %ifarch x86_64
> # Automatically install the 32-bit variant if the 64-bit variant has
> # been installed.  This covers the case when glibc.i686 is installed
> # before nss_db.x86_64.  (See above for the other ordering.)
> Recommends: (nss_db(x86-32) if glibc(x86-32))
> %endif
> 
> if I perform following steps, nss_db.i686 won't be installed:

Where does the repodata come from? An old createrepo program (from Red Hat Enterprise Linux 7) does not process Recommends: dependencies at all, so they are missing from the repodata, and DNF cannot act on them. This is consistent with the behavior you observe.

If you regenerate the repodata with the appropriate createrepo version, I'm sure this will work.

Comment 16 Filip Januš 2020-05-18 13:03:33 UTC
Hi Florian,
there was probably a misunderstanding, I tried to describe behavior on Fedora 31, not on RHEL7, but as you recommended, I tried to create my own repo by using the latest version of createrepo tool. But it behaves in the same way as I described above. So I made a build of nss_nis in copr[1] with simple recommendation: 
%ifarch x86_64
Recommends: nss_nis(x86-32)
%endif
then from built rpms I created own repo[1] and add, enabled in dnf. 
But the result was the same as before, the weak dependency is missing.


[root@ci-vm-10-0-138-150 ~]# dnf install nss_nis
Beaker Client - Fedora30                                                                                                        88 kB/s |  11 kB     00:00    
Beaker harness                                                                                                                 505 kB/s | 133 kB     00:00    
Fedora Modular 31 - x86_64                                                                                                     1.1 MB/s | 5.2 MB     00:04    
Fedora Modular 31 - x86_64 - Updates                                                                                           913 kB/s | 4.1 MB     00:04    
Fedora 31 - x86_64 - Updates                                                                                                   922 kB/s |  25 MB     00:27    
Fedora 31 - x86_64                                                                                                              10 MB/s |  71 MB     00:06    
created by dnf config-manager from https://fjanus.fedorapeople.org/testrepo/                                                   4.0 kB/s | 1.4 kB     00:00    
QA Tools Incubator                                                                                                             211 kB/s | 407 kB     00:01    
QA Tools Incubator Testing                                                                                                     146 kB/s | 122 kB     00:00    
Dependencies resolved.
===============================================================================================================================================================
 Package                        Architecture                  Version                           Repository                                                Size
===============================================================================================================================================================
Installing:
 nss_nis                        x86_64                        3.1-5.fc31                        fjanus.fedorapeople.org_testrepo_                         42 k

Transaction Summary
===============================================================================================================================================================
Install  1 Package

Total download size: 42 k
Installed size: 82 k
Is this ok [y/N]:    


But I tried to change section Recommands to some other package and it works[3].
%ifarch x86_64                                                                  
Recommends: pg_repack                                                           
%endif   



root@ci-vm-10-0-138-45 ~]# dnf install nss_nis
Last metadata expiration check: 0:00:07 ago on Mon 18 May 2020 08:41:19 AM EDT.
Dependencies resolved.
===============================================================================================================================================================
 Package                               Architecture               Version                          Repository                                             Size
===============================================================================================================================================================
Installing:
 nss_nis                               x86_64                     3.1-5.fc31                       fjanus.fedorapeople.org_testrepo_                      41 k
Installing dependencies:
 libicu                                x86_64                     63.2-3.fc31                      fedora                                                9.3 M
 libpq                                 x86_64                     12.2-1.fc31                      updates                                               212 k
 postgresql                            x86_64                     11.7-1.fc31                      updates                                               1.5 M
 postgresql-server                     x86_64                     11.7-1.fc31                      updates                                               5.2 M
Installing weak dependencies:
 pg_repack                             x86_64                     1.4.4-1.fc31                     fjanus.fedorapeople.org_testrepo_                      86 k

Transaction Summary
===============================================================================================================================================================
Install  6 Packages

Total download size: 16 M
Installed size: 60 M
Is this ok [y/N]: 



So from my point of view this behavior is not caused by old repodata, but it could be some dnf feature or bug which don't allow self-dependency.


[1] https://copr.fedorainfracloud.org/coprs/fjanus/nss_nis/build/1388345/
[2] https://fjanus.fedorapeople.org/testrepo/
[3] https://fjanus.fedorapeople.org/testrepo1/

Comment 33 Filip Januš 2020-12-16 11:22:35 UTC
since it's a corner case and not easy to solve, with a documented workaround, I am closing it as WONTFIX, but feel free to reopen if needed


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