[Bug 436963] New: zypper takes EOF from stdin as "Yes"
https://bugzilla.novell.com/show_bug.cgi?id=436963 Summary: zypper takes EOF from stdin as "Yes" Product: openSUSE 11.1 Version: Beta 3 Platform: All OS/Version: Linux Status: NEW Severity: Major Priority: P5 - None Component: libzypp AssignedTo: zypp-maintainers@forge.provo.novell.com ReportedBy: max@novell.com QAContact: qa@suse.de Found By: Development When running zypper with stdin being /dev/null, it skips over the "Continue?" question interpreting the EOF as if the user had given the default answer. This situation can easily happen when the list of packages to install or uninstall comes out of a pipe and is passed to zypper via xargs, e.g.: $ rpm -qa | grep kde | xargs zypper rm In this case the user has no chance to verify the actual list of pacages zypper wants to remove and refine the call if he is not pleased with it. I think EOF on stdin when a safety question was asked should at least lead the zypper process to exit immediately with a meaningful error message instead of assuming that the default answer was given. A better and more user friendly alternative would be that if the process has a controlling tty, zypper opens /dev/tty and reads the user input from there. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=436963 Ján Kupec <jkupec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jkupec@novell.com AssignedTo|zypp-maintainers@forge.provo.novell.com |jkupec@novell.com Status|NEW |ASSIGNED Priority|P5 - None |P3 - Medium -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=436963 User jkupec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=436963#c1 Ján Kupec <jkupec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |max@novell.com --- Comment #1 from Ján Kupec <jkupec@novell.com> 2008-10-22 08:38:53 MDT --- Thanx for the report. (In reply to comment #0 from Reinhard Max)
I think EOF on stdin when a safety question was asked should at least lead the zypper process to exit immediately with a meaningful error message instead of assuming that the default answer was given.
Fixed.
A better and more user friendly alternative would be that if the process has a controlling tty, zypper opens /dev/tty and reads the user input from there.
Any hint how to do this? (how to check whether zypper has a controlling tty). I'm not experienced in terminal handling. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=436963 User pbaudis@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=436963#c2 Petr Baudis <pbaudis@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pbaudis@novell.com --- Comment #2 from Petr Baudis <pbaudis@novell.com> 2008-10-24 02:02:05 MDT --- /dev/tty is the controlling tty if the process has any, just try to open() it - if it fails (with -ENXIO), you have no controlling tty either. So the general idea would be probably something like: ask_fd = 0; if (!isatty(ask_fd)) ask_fd = open("/dev/tty", O_RDWR); if (ask_fd < 0) die("no way how to ask for confirmation"); ask(ask_fd); -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=436963 User jkupec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=436963#c3 Ján Kupec <jkupec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|max@novell.com | Status Whiteboard| |in-svn --- Comment #3 from Ján Kupec <jkupec@novell.com> 2008-10-27 10:18:16 MDT --- Thax for the info! Done in svn, to be in zypper 0.12.11 for beta 4 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=436963 User jkupec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=436963#c4 Ján Kupec <jkupec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Status Whiteboard|in-svn | --- Comment #4 from Ján Kupec <jkupec@novell.com> 2008-10-27 12:23:56 MDT --- submitted -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com