bugzilla-daemon at mindrot.org
2023-Jan-17 08:22 UTC
[Bug 3523] New: standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Bug ID: 3523
Summary: standard output file descriptor was set with:
O_NONBLOCK, but restore with flag: 0
Product: Portable OpenSSH
Version: 9.1p1
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: ssh
Assignee: unassigned-bugs at mindrot.org
Reporter: mark.zhang at nokia-sbell.com
Hello,
We have one script to call ssh command to do some action on other
server.
then output some string to the standard output, then append to one
file.
But the append flag doesn't take effect.
# ssh -V
OpenSSH_9.1p1, OpenSSL 1.1.1k FIPS 25 Mar 2021
-- scripts a.sh
ssh -l root <other ssh server> "ls 1>/dev/null 2>&1"
&
sleep 2
echo "abc"
===
Reproduce with ksh a.sh >> ddd
the "abc" will be written at the first line of file ddd;
Expected,
"abc" was at the last line of file ddd.
Following commit, seems make enhancement for the non-blocking action;
https://github.com/openssh/openssh-portable/commit/7be4ac813662f68e89f23c50de058a49aa32f7e4
Please help if the commit will cause the problem.
output of systemtap
1673941921913: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8401
1673941921913: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8401
1673941921915: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8401
1673941921915: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8401 /// with flag: o_append
1673941922004: setfl: process=ssh, pid=4177330: file name =ddd,
flag=8401, arg=8c01 //set with flag non-block
1673941922135: setfl: process=ssh, pid=4177330: file name =ddd,
flag=8c01, arg=0 // why set to 0;
1673941923917: ext4_write_checks: inode->i_size: 8455228, name: ksh,
pid=4177329, off=0, file_off=0, count=4, flag=0, file_flag=8001,
filename=ddd
1673941923917: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8001
1673941923917: vfs_llseek: process=ksh, pid=4177329: file name =ddd,
flag=8001
Thanks,
Mark
--
You are receiving this mail because:
You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-17 10:30 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |djm at mindrot.org,
| |dtucker at dtucker.net
Attachment #3651| |ok?(dtucker at dtucker.net)
Flags| |
--- Comment #1 from Damien Miller <djm at mindrot.org> ---
Created attachment 3651
--> https://bugzilla.mindrot.org/attachment.cgi?id=3651&action=edit
restore exact flags at exit
Thanks for the report. Could you try this patch?
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-17 10:31 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Blocks| |3480
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=3480
[Bug 3480] tracking bug for openssh-9.2
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-17 11:22 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #3651|ok?(dtucker at dtucker.net) |ok+
Flags| |
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-17 12:49 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523 --- Comment #2 from mzhan017 <mark.zhang at nokia-sbell.com> --- Hello Miller, Thanks for your quick response and fix. The patch is good by my test. Thanks, Mark systemtap's result, the flag could be restored. time: 1673959685099: vfs_llseek: process=ksh, pid=1168362: file name =ddd, flag=8401 time: 1673959685099: vfs_llseek: process=ksh, pid=1168362: file name =ddd, flag=8401 time: 1673959685100: vfs_llseek: process=ksh, pid=1168362: file name =ddd, flag=8401 time: 1673959685101: vfs_llseek: process=ksh, pid=1168362: file name =ddd, flag=8401 time: 1673959685192: setfl: process=ssh, pid=1168363: file name =ddd, flag=8401, arg=8c01 time: 1673959685319: setfl: process=ssh, pid=1168363: file name =ddd, flag=8c01, arg=8401 time= 1673959687102: inode->i_size: 8455256, name: ksh, pid=1168362, off=0, file_off=0, count=4, flag=2, file_flag=8401, filename=ddd -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-18 02:32 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Damien Miller <djm at mindrot.org> ---
Thanks this fix has been committed and will be in OpenSSH 9.2, due for
release next month.
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2023-Mar-17 02:38 UTC
[Bug 3523] standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
https://bugzilla.mindrot.org/show_bug.cgi?id=3523
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #4 from Damien Miller <djm at mindrot.org> ---
OpenSSH 9.3 has been released. Close resolved bugs
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.