85,859 reputation
1093204
bio website
location European Union
age
visits member for 2 years
seen 4 hours ago

Aug
19
revised how to use dd to fill drive with 1's
added 14 characters in body
Aug
19
comment Why are rmdir and unlink two separate system calls?
@Gilles, no, chroot() doesn't do a chdir(), so if your current directory was outside the jail before the chroot(), it still is after. That's why the literature always says to close your references to things outside the jail when doing chroot, otherwise you can escape the jail. (see man 2 chroot on Linux for instance, and you can try it for yourself)
Aug
19
answered Nexenta bash script uses /usr/sun/bin/sed instead of /usr/bin/sed
Aug
19
comment How could i flip content of a binary file with bash commands
@G-Man, more like "$(printf '\\%o' {255..0})" with zsh/bash/ksh93. Though, since it's always the same, there's no good reason you'd want to generate it every time.
Aug
19
answered how to use dd to fill drive with 1's
Aug
19
comment How could i flip content of a binary file with bash commands
What's a bash command?
Aug
19
answered How could i flip content of a binary file with bash commands
Aug
19
awarded  Enlightened
Aug
19
awarded  Nice Answer
Aug
19
revised Nexenta bash script uses /usr/sun/bin/sed instead of /usr/bin/sed
formatting
Aug
19
comment Get text between a word and the last line?
Or <file tac | sed /word/q | tac for the last word to end of file (like yours, assuming word is to be found in the file).
Aug
19
comment Get text between a word and the last line?
The first one can also be written awk /word/,0 file
Aug
19
comment Why are rmdir and unlink two separate system calls?
Alright, that's rmdir / that returns EBUSY, removing it by another relative path (other than . and ..) is OK (though that means your current directory must be outside the chroot jail which is generally not the case when chroot is used).
Aug
19
comment Why are rmdir and unlink two separate system calls?
I'm not sure what they mean by or is the root directory of the calling process. mkdir test; sudo strace -e chroot,rmdir perl -e 'chroot("test"); rmdir("test")' shows both chroot and rmdir succeed.
Aug
19
comment Nexenta bash script uses /usr/sun/bin/sed instead of /usr/bin/sed
Is your script run in a different Solaris zone? How is it invoked? Can you upload your /usr/bin/sed somewhere? What version of Nexenta is it? I don't understand how truss /usr/bin/sed can not show execve("/usr/bin/sed",...)
Aug
19
comment Coloring different sources for tail
-W interactive seems to be mawk-specific. (the way mawk buffers its input by default is also unique, and -W interactive would not be needed in other awk implementations).
Aug
19
comment Why are rmdir and unlink two separate system calls?
If I read your answer properly, you're saying rmdir(dir) doesn't work if dir is in use. That is not true on Linux at least, where rmdir(getcwd()) works just fine (provided the current directory is empty).
Aug
19
comment Why are rmdir and unlink two separate system calls?
Well rm -rf "$PWD" works and does remove the current directory. I think the reason there's a rmdir() is probably historical (initially, directories were unlinked() and rmdir (the command) was unlinking dir/., dir/.. and dir, and when that was moved to the kernel, that had to be a new syscall doing all 3 at least for a transition period or something like that)
Aug
19
comment Generating file with ASCII numbers using /dev/urandom?
@programings, no, just not very efficient compared to < /dev/urandom perl -pe 'BEGIN{$/=\4096}; $_=unpack("b*",$_)' for instance.
Aug
19
comment Generating file with ASCII numbers using /dev/urandom?
Note that the second one for instance needs to read (on average) 1280 MB from /dev/uramdom to get 10 MB of output. See pv -cN a < /dev/urandom | tr -cd 01 | pv -cN b > /dev/null