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


Groups > linux.debian.user > #261926

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 04:40 +0200
Message-ID <Hi69s-bzRl-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> <HhLy1-bmTS-1@gated-at.bofh.it> <HhRWN-bqUN-5@gated-at.bofh.it>
Organization BunsenLabs

Show all headers | View raw


Many thanks to Michael for finding the change in sudo behaviour!

For historical accuracy:
On 25/09/2023 20:24, Greg Wooledge wrote:
> On Mon, Sep 25, 2023 at 01:35:38PM +0900, John Crawley wrote:
>>> 4) In a bash shell as root (e.g. "su" or "sudo -s"), do:
>>>
>>>      errors=$(apt-get install mirage 2>&1 1>/dev/tty)
>>
>> -bash: syntax error near unexpected token `2'
>>
>> So bash as root has a problem with the redirection.
> 
> At this point I'm guessing you made a typo.  Since you didn't show us
> the command you typed, that's my official guess.  Any alternative is
> too far beyond belief.

It must have been a typo.
I should have copy-pasted the command, which was at that point possible, but anyway that syntax error no longer appears.

>> But this worked OK in the same root shell:
>>
>> exec 3>1
>> errors=$( apt-get install mirage 2>&1 1>&3 )
>> exec 3>&-
>>
>> If 'mirage' is replaced with 'mirag' then $errors holds the error message.
>>
>> So at least something is working!
> 
> Note your typo in the first exec command.  You've got FD 3 redirected
> to a file named '1', rather than dup-ing stdout.

Oops, sorry. With corrected commands it still works, even with default "use_pty" in sudoers.

So running in a root shell, the new setting does not interfere. Clearly sudo only.

-- 
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