Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
strace outputs nothing when used in wgetpaste
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Mon Apr 12, 2021 12:58 pm    Post subject: strace outputs nothing when used in wgetpaste Reply with quote

When using strace in wgetpaste, wgetpaste returns "Apparently nothing was received. Perhaps the connection failed."

Example:
Code:
wgetpaste -c 'strace echo hello

Am I doing something wrong or is this a bug?

Edit:
Think I figured it out. It's not a problem with wgetpaste, it's that strace's output is not considered output like cat's output for example. Rather, it's just text on the terminal (don't really know how else to explain it).

So if you were to do strace echo hello > strace_echo_hello.txt, the file would be empty.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Mon Apr 12, 2021 6:38 pm    Post subject: Reply with quote

Wait....!

Try:
Code:
echo "Hi" >c1 2>c2
cat c1
cat c2

strace ls >c1 2>c2
cat c1
cat c2

Can you see the difference? The output of echo goes to STDOUT. The output of strace goes to STDERR. Use "2>&1" to redirect the output of strace to STDOUT. Or, even better, write the output of strace to a file (using option '-o') and wgetpaste the file.
Back to top
View user's profile Send private message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Mon Apr 12, 2021 7:19 pm    Post subject: Reply with quote

Ohhhhhhhhhh
Back to top
View user's profile Send private message
username234
Guru
Guru


Joined: 09 May 2007
Posts: 332

PostPosted: Mon Apr 12, 2021 8:11 pm    Post subject: Reply with quote

stdout vs stderr does not make a difference here. wgetpaste captures both. Redirecting strace output to a file also do not solve (or work-around) the problem.
_________________
Creating usernames when you're
in a creative slump is a bad idea
because if you are when you do
then you end up with uninspiring
alphanumeric cocktails like the
one directly above.
Back to top
View user's profile Send private message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Mon Apr 12, 2021 8:29 pm    Post subject: Reply with quote

So in that case would it be a bug?
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Mon Apr 12, 2021 9:10 pm    Post subject: Reply with quote

username234 wrote:
stdout vs stderr does not make a difference here. wgetpaste captures both. Redirecting strace output to a file also do not solve (or work-around) the problem.

Well,
Code:
strace echo hello 2>strace_echo_hello.txt

works,
Code:
strace echo hello 2>&1 | wgetpaste

works as well (although it mixes STDOUT and STDERR) and
Code:
wgetpaste -c 'strace echo hello'

also works, see https://dpaste.com/BAXYLP5LZ

Anyway, I recommend:
Code:
strace -o /tmp/strace_output.txt echo hello
more /tmp/strace_output.txt       # check the result
wgetpaste /tmp/strace_output.txt
Back to top
View user's profile Send private message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Tue Apr 13, 2021 12:25 pm    Post subject: Reply with quote

I did a strace of
Code:
wgetpaste -c 'strace echo hello'
using
Code:
strace -o strace.txt wgetpaste -c 'strace echo hello' 2>&1 | wgetpaste
and it says "stdin" on the dpaste. Is that right?
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Tue Apr 13, 2021 1:58 pm    Post subject: Reply with quote

Your command is too complicated. I wouldn't write something like that. Difficult to understand. Bad style!

But if I execute your command, I get this result: https://dpaste.com/7HXWKW8FF.
And that's what I would expect.

Which shell do you use? Bash?
Back to top
View user's profile Send private message
Shidouuu
n00b
n00b


Joined: 28 Mar 2021
Posts: 16

PostPosted: Tue Apr 13, 2021 2:25 pm    Post subject: Reply with quote

Yeah
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum