Bug 1280034

Summary: dnf fails if stdin (fd 0) is not open: AttributeError: 'NoneType' object has no attribute 'isatty'
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jshubin, jsilhan, kchamart, mbooth, mluscon, packaging-team-maint, pnemade, ptoscano, rbalakri, rjones, virt-maint, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1280029 Environment:
Last Closed: 2015-11-10 20:27:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard W.M. Jones 2015-11-10 19:25:22 UTC
Running `dnf -y update --best` when stdin (fd 0) is not open
gives this error:

    [. . .]
    Delta RPMs reduced 93.7 MB of updates to 54.7 MB (41.1% saved)
    warning: /var/cache/dnf/updates-e042e478e0621ea6/packages/kernel-4.2.5-300.fc23.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 34ec9cba: NOKEY
    The downloaded packages were saved in cache till the next successful transaction.
    You can remove cached packages by executing 'dnf clean packages'.
    Traceback (most recent call last):
      File "/bin/dnf", line 35, in <module>
        main.user_main(sys.argv[1:], exit_code=True)
      File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 198, in user_main
        errcode = main(args)
      File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 84, in main
        return _main(base, args)
      File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 144, in _main
        ret = resolving(cli, base)
      File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 173, in resolving
        base.do_transaction(display=displays)
      File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 220, in do_transaction
        self.gpgsigcheck(downloadpkgs)
      File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 251, in gpgsigcheck
        if not sys.stdin.isatty() and not ay:
    AttributeError: 'NoneType' object has no attribute 'isatty'

I believe the version of dnf is:

dnf-1.1.3-1.fc23.noarch

Comment 1 Richard W.M. Jones 2015-11-10 19:32:34 UTC
I should say that the reason that stdin is not connected to anything
is a bug in libguestfs (see bug 1280029).  But I still think this
is also a bug in dnf because it should do something like:

if (sys.stdin and not sys.stdin.isatty ()) and not ay:
  [etc]

Comment 2 Richard W.M. Jones 2015-11-10 20:27:28 UTC
Looks like James already filed the dnf bug.

*** This bug has been marked as a duplicate of bug 1278382 ***