Hallo, Am Mon, 13 Jun 2011, Christian Brabandt schrieb:
PS: diesmal keine Zufallssig. -- "Anybody who really thinks /bin/true should report a version number and a help string (or even a copyright notice) needs to get his head examined."
Haha, das frag ich mich ja auch schon lange:
#v+ chrisbra@host: ls -l /bin/true -rwxr-xr-x 1 root root 16060 28. Apr 2010 /bin/true #v-
16K für ein /bin/true, da werden bestimmt noch Primzahlen berechnet oder so.
Auf meiner ex-6.2/32bit mit Kernel 2.4.x hatte ich die tinyutils (oder so) Version von /bin/true. 45 Bytes hat das Binary. Läuft leider nicht unter x64_64 (SEGFAULT). Siehe: http://www.muppetlabs.com/%7Ebreadbox/software/tiny/ true.asm source [..] This program returns an exit code of either zero or one, depending on whether it is invoked with the name "true" or "false", respectively. This one is the runt of the litter. Its size is 45 bytes. Count them. This is the smallest it is possible for a Linux ELF executable to be. So, und ich hab jetzt mal (zwar deutlich größere, aber dennoch in gewisserweise minimale true/false gebastelt), für noch kleinere fehlt mir a) das Assembler / ELF Wissen und b) auch der Ehrgeiz. ==== true64.asm.in ==== ;; true64.asm.in: (c) dnh@opensuse.org based on ;; http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html ;; GNU General Public License (version 2 or later). No warranty. BITS 64 GLOBAL _start SECTION .text _start: mov eax, 1 mov ebx, @RETVAL@ int 0x80 ==== ==== Makefile ==== # Makefile for true64.asm.in: (c) dnh@opensuse.org based on # http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html # GNU General Public License (version 2 or later). No warranty. BIN=true false all: $(BIN) true: true.o false: false.o true64.asm: true64.asm.in sed 's/@RETVAL@/0/;' $< > $@ false64.asm: true64.asm.in sed 's/@RETVAL@/1/;' $< > $@ %.o: %64.asm nasm -f elf64 -o $@ $< %: %.o gcc -Wall -s -nostdlib -o $@ $< clean: $(RM) *64.asm *.o $(BIN) ==== Beide Dateien in ein Verzeichnis rein, und per 'make' bauen. Installation ins System bitte nur nach eigenen Tests per Hand. Braucht make, sed, nasm und gcc. $ ls -l true false -rwxr-xr-x 1 dh dh 528 Jun 13 17:59 false -rwxr-xr-x 1 dh dh 528 Jun 13 17:59 true Geht doch halbwegs ;) $ ls -l `which true` `which false` -rwxr-xr-x 1 root root 528 Jun 13 18:02 /bin/false -rwxr-xr-x 1 root root 528 Jun 13 18:02 /bin/true $ file `which true` `which false` /bin/true: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped /bin/false: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped Im Vergleich zu den GNU Varianten massiv schlanker ;) Allerdings: in der Praxis ist obiges eher irrelevant: der entsprechende Code aus der glibc (der GNU true/false so fett macht) ist sowieso im RAM, und der Textkram (Version, --help) ist dann auch nicht so fett. Aber: Linus hat recht. Ergo ... -dnh -- BUGS It is not yet possible to change operating system by writ ing to /proc/sys/kernel/ostype. -- Linux sysctl(2) manpage -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken Sie eine Mail an: opensuse-de+help@opensuse.org