Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/portage/gpg.py: send gpg output to stdout, then send stdout to /dev/null #1083

Closed
wants to merge 1 commit into from

Conversation

AndrewAmmerlaan
Copy link
Member

GnuPG removes the --output file on failure. Removing /dev/null breaks all kinds of things. So lets use a temporary file for the output instead.

If the file already exists then we remove it to prevent GnuPG from complaining about the file already existing and asking us if we want to choose a different --output file.

Closes: https://bugs.gentoo.org/912808

lib/portage/gpg.py Outdated Show resolved Hide resolved
@floppym
Copy link
Contributor

floppym commented Aug 23, 2023

Upon further thought, I think we should just pass --output - and redirect stdout to /dev/null as suggested by gnupg upstream. That can be accomplished by passing stdout=subprocess.DEVNULL to subprocess.Popen.

…ev/null

GnuPG removes the --output file on failure. Removing /dev/null breaks all kinds
of things. Instead of telling GnuPG to output to /dev/null we output to
stdout and then send the stdout to /dev/null, this avoids the problem where
/dev/null is removed when the key fails to unlock.

Closes: https://bugs.gentoo.org/912808
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
@AndrewAmmerlaan
Copy link
Member Author

Upon further thought, I think we should just pass --output - and redirect stdout to /dev/null as suggested by gnupg upstream. That can be accomplished by passing stdout=subprocess.DEVNULL to subprocess.Popen.

Sure, this is also fine by me.
This certainly makes the patch smaller, and avoids having to deal with the situation where the file might already exist.

@AndrewAmmerlaan AndrewAmmerlaan changed the title lib/portage/gpg.py: use temporary gpg out file instead of /dev/null lib/portage/gpg.py: send gpg output to stdout, then send stdout to /dev/null Aug 24, 2023
@AndrewAmmerlaan
Copy link
Member Author

Closed via 9d27833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants