[Bug 3523] New: standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue Jan 17 19:22:06 AEDT 2023


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.


More information about the openssh-bugs mailing list