190 reputation
18
bio website ptspts.blogspot.com
location Zurich, Switzerland
age 33
visits member for 4 years
seen Nov 24 at 15:14

Programming for fun and profit. Hacking together TeX macros. Written gzip decompressor in PostScript. Writing multilingual programs, such as:

%:/*:if 0;"true" +s ||true<</;#|+q|*/include<stdio.h>/*\_/
{\if(%)}newpath/Times-Roman findfont 20 scalefont setfont(
%%)pop 72 72 moveto(Just another PostScript hacker,)show((
t)}. t:-write('Just another Prolog hacker,'),nl,halt. :-t.
:-initialization(t). end_of_file. %)pop pop showpage(-: */
int main(){return 0&printf("Just another C%s hacker,\n",1%
sizeof'2'*2+"++");}/*\fi}\csname @gobble\endcsname{\egroup
\let\LaTeX\TeX\ifx}\if00\documentclass{article}\begin{doc%
ument}\fi Just another \LaTeX\ hacker,\end{document}|if 0;
/(J.*)\$sh(.*)"/,print"$1Perl$2$/"if$_.=q # hack the lang!
/
sh=sh;test $BASH_VERSION &&sh=bash;test $POSIXLY_CORRECT&&
sh=sh;test  $ZSH_VERSION && sh=zsh;awk 'BEGIN{x="%c[A%c[K"
printf(x,27,27)}';echo "Just another $sh hacker," #)pop%*/

Dec
15
awarded  Necromancer
Nov
23
comment How to print total number of file descriptors with index 24
Use setopt nullglob in zsh the get 0 when there are no matches.
May
20
comment useradd command's argument issue
Please provide the full shell script anyway (it can be as short as the command above), so it's easier for others to reproduce the problem.
May
20
comment useradd command's argument issue
This argument truncation looks very strange to me. Does it also happen if you create a shell script (#!/bin/sh) and run it? Can you please add the full source of your shell script and the full strace output? What happens if you run the shell script with /bin/bash?
Jun
29
awarded  Critic
May
19
comment How do I detect wheter the audio cable is connected?
The hardware can detect it, because it mutes the internal speaker as soon as I connect the external speaker.
May
19
comment How do I detect wheter the audio cable is connected?
@CL: The device at the other end is an externally powered speaker, which is turned on. I don't think it has any smart self-announcement capabilities. How do I figure out which HDA codec I have?
May
19
asked How do I detect wheter the audio cable is connected?
May
6
revised Cross-process dup on Linux
fixed argument order
May
6
awarded  Scholar
May
6
accepted Cross-process dup on Linux
May
6
suggested approved edit on Cross-process dup on Linux
May
4
comment Cross-process dup on Linux
@goldilocks, @Gilles: Yes, you are correct that /proc/$pid/mem is read-only. I've just tried it, and reading /proc/$pid/mem has worked, but writing it has failed with Invalid argument (even as root). Thank you for the clarification!
May
4
comment Cross-process dup on Linux
@Gilles: Can you point me to a working implementation of that? I couldn't find one, and I'd like to reuse a good one if possible, because I have the impression that using ptrace naively is very error-prone and unstable -- and I don't want to make the other process crash.
May
4
comment Cross-process dup on Linux
Thank you for the clarification. FYI I can't give +1 to your answer because the beginning (you can't access the memory of an unrelated process) is still incorrect, because ptrace(2) can do it. You are also incorrect about writing the memory of another process: /proc/13115/mem is writable, and it affects the other process. I fail to see why your explanation about buffers makes the socket impossible to dup: in fact, sendmsg(2) can do it using SCM_RIGHTS, also it gets duplicated upon fork(2).
May
4
awarded  Student
May
4
awarded  Commentator
May
4
comment Cross-process dup on Linux
I'm not interested in sniffing packets. I need a duplicate of the socket file descriptor.
May
4
comment Cross-process dup on Linux
Thank you for composing your answer. What you are saying (you can't access the memory of an unrelated process) is incorrect, because ptrace(2) can do it. Are you sure that what I need can't be done? If so, what is your justification? stackoverflow.com/questions/11214066/… ?
May
4
comment Cross-process dup on Linux
@slm: Yes, I have permissions, all UIDs are the same.