首页 » 系统相关 » ‘sed’ bug? couldn’t close : Permission denied

‘sed’ bug? couldn’t close : Permission denied

On SLES 12 sp4, a shell  call sed with ‘-i’ flag   to modify the file execution and report an errort,  This shell worked well on the previous server, The linux user (tried also with root) can create, read and update any files in the NFS mounted folder. But the temporary file created by sed doesn’t work.

cbs@anbob:~/roamingfile> seq 1 5 >text.txt
cbs@anbob:~/roamingfile> id
uid=2001(cbs) gid=6601(onip) groups=6601(onip),100(users),2000(timesten),2001(ttadmin),2002(cbsadm),2003(dba),2004(oinstall)
cbs@anbob:~/roamingfile> sed -i '1d' 123.txt
sed: couldn't close <unknown>: Permission denied

cbs@anbob:~/roamingfile> sed --version
sed (GNU sed) 4.2.2

Note:
If the permission problem usually occurs in the open phase, here is the prompt close, Using strace tracking this show the error is reported when the file generated temporarily by sed try to close.(note root user work fine)

It works well after changing to another version of sed(SLES 11)

 
cbs@anbob:~/roamingfile> /another_release/sed -i '1d' 123.txt
cbs@anbob:~/roamingfile>
cbs@anbob:~/roamingfile> cat 123.txt 
2 
3 
4 
5
cbs@anbob:~/roamingfile> /another_release/sed --version
GNU sed version 4.1.5
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

There are reasons to suspect that this is a bug in the current sed, and you can use other ksh to report an error.

打赏

对不起,这篇文章暂时关闭评论。