Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #261927

Re: apt-get aborts in subshell with redirections on Debian 12

From John Crawley <john@bunsenlabs.org>
Newsgroups linux.debian.user
Subject Re: apt-get aborts in subshell with redirections on Debian 12
Date 2023-09-26 05:00 +0200
Message-ID <Hi6sN-bzXL-3@gated-at.bofh.it> (permalink)
References (4 earlier) <HhHNM-bkuD-3@gated-at.bofh.it> <HhJZf-blOm-3@gated-at.bofh.it> <HhKLD-bmjt-1@gated-at.bofh.it> <HhPUZ-bpJA-11@gated-at.bofh.it> <HhRWN-bqUN-3@gated-at.bofh.it>
Organization BunsenLabs

Show all headers | View raw


On 25/09/2023 20:21, Greg Wooledge wrote:
> On Mon, Sep 25, 2023 at 11:14:24AM +0200, Michael wrote:
>> so i looked into /etc/sudoers and all /etc/sudoers.d/* and found two
>> suspicous flags:
>>
>> /etc/sudoers:
>> Defaults       use_pty
>>
>> /etc/sudoers.d/0pwfeedback:
>> Defaults pwfeedback
>>
>> then consulting the sudo manpage convinced me, it was the 'use_pty' flag (in
>> section SUDOERS OPTIONS). after removing that flag everything works as
>> 'expected':
> 
> Well, that is quite the find.  

Indeed! Many thanks Michael.

For background, I followed up some links to get:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657784
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1011624
https://bugs.kde.org/show_bug.cgi?id=452532#c28
https://salsa.debian.org/sudo-team/sudo/-/commit/59db341d46aa4c26b54c1270e69f2562e7f3d751

> Given the presence of an /etc/sudoers.dpkg-dist file on my system,
> which does in fact contain this:
> 
> # This fixes CVE-2005-4890 and possibly breaks some versions of kdesu
> # (#1011624, https://bugs.kde.org/show_bug.cgi?id=452532)
> Defaults        use_pty
> 
> it looks like you've solved *most* of the mystery.  

But @Greg, if you have "Defaults        use_pty" why haven't you been getting the same instant aborts that I was?

> I still don't get
> why it matters whether the command was executed from bash or dash --

...or ksh or zsh?? Only bash seemed to suffer from having stdin cut off.

Anyway, for my personal purposes, this new behaviour looks too unpredictable and I plan to fall back on capturing stderr in a tempfile. Kludgy but maybe more robust than multiple redirections?

:~$ temp=$(mktemp)
:~$ sudo apt-get install nopkg 2>"$temp"
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
:~$ errors=$(<"$temp")
:~$ echo "$errors"
E: Unable to locate package nopkg
:~$ rm "$temp"

It would be nice to unpick the rest of the mystery though...

(Also, if some day bash had a way of making a variable look like a file for writing.)

-- 
John

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-24 09:40 +0200
  Re: apt-get aborts in subshell with redirections on Debian 12 Michel Verdier <mv524@free.fr> - 2023-09-24 12:10 +0200
    Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-24 14:40 +0200
      Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 02:20 +0200
        Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 02:40 +0200
          Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:00 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:20 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 05:50 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 06:40 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 04:40 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 Michael <ml@hemathor.de> - 2023-09-25 11:20 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:00 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-26 05:10 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:20 +0200
                sudo+use_pty+urxvt+pipe [WAS: apt-get aborts in subshell with  redirections on Debian 12] John Crawley <john@bunsenlabs.org> - 2023-12-24 09:50 +0100

csiph-web