Bug 40857 - pstree output cannot be redirected to a file
Summary: pstree output cannot be redirected to a file
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: psmisc (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Vitaly Chikunov
QA Contact: qa-sisyphus
URL:
Keywords:
: 41600 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-04 09:57 MSK by Ivan A. Melnikov
Modified: 2021-12-21 04:59 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan A. Melnikov 2021-09-04 09:57:46 MSK
While trying to save `pstree -ap` output to a file and I'm getting a really strange error:

$ pstree -ap > pstree.txt
File size limit exceeded

Of course, I don't have any filesize limit on this system:

$ ulimit -f
unlimited

It turns out that pstree itself sets the filesize limit -- probably in some kind of a sandboxing effort:

$ strace -e /limit pstree -ap > /dev/null
prlimit64(0, RLIMIT_NPROC, {rlim_cur=0, rlim_max=0}, NULL) = 0
prlimit64(0, RLIMIT_FSIZE, {rlim_cur=0, rlim_max=0}, NULL) = 0
prlimit64(0, RLIMIT_NOFILE, {rlim_cur=0, rlim_max=0}, NULL) = 0
+++ exited with 0 +++

So, obvious workaround like intermediate `cat` works:

$ pstree -ap | cat > pstree.txt
$ echo $?
0
$ wc pstree.txt
  578  2120 22017 pstree.txt

But, well, such limitation on where output can go definitely looks like a bug to me.
Comment 1 Repository Robot 2021-09-04 12:17:13 MSK
psmisc-23.3-alt3 -> sisyphus:

 Sat Sep 04 2021 Vitaly Chikunov <vt@altlinux> 23.3-alt3
 - Fix output redirect (closes: #40857).
Comment 2 Vitaly Chikunov 2021-12-21 04:59:08 MSK
*** Bug 41600 has been marked as a duplicate of this bug. ***