Questions about windows support

H. S. Teoh hsteoh at
Mon Feb 20 19:27:36 PST 2012

On Tue, Feb 21, 2012 at 12:07:41AM -0300, Juan Manuel Cabo wrote:
> > That is so COOL!! I remember f*cking up one of my first linux computers
> > that way. If I had known, I wouldn't have to go back to reinstall the
> > many diskettes of slackware (no live cds at that time!, no easy way
> > to fix the fs).
> What happened was (If I remember correctly) that I renamed the /lib directory.

Haha, ouch. That would suck, real bad.

It could be worse. Some guy somehow messed up his packaging system so
much that when he ran an upgrade command, the packager somehow decided
that it had to uninstall EVERY package on the system (including
essential stuff like /bin and /lib).  Which it proceeded to do, until it
deleted so much of the system that it broke itself and crashed. Leaving
a system without /bin, /lib, or /usr.

It was from this guy's website that I learned how to copy binary files
using echo. :-)

> Again, this:
> >> In the end I had to use bash's built-in echo command to recreate a
> >> statically-linked busybox binary via copy-n-pasting over the
> >> terminal,
> is so cool!!

I don't know if that's cool, or just plain crazy. You have no idea how
hard it is to actually create an executable using echo commands. What
with bash interpolating the input strings at various places multiple
times, you have to double-escape, triple-escape, even quadruple-escape
some of the hex sequences just to get it to work properly.

For example, I had to represent a *single* binary 0 as \\\\0000,
because I couldn't paste the commands directly at the prompt, since bash
does something with the terminal after every line, so the input buffer
would overflow and start truncating commands about 5-6 lines into the
paste. So I had to use this hack:

	(IFS=$'\n';while read line;do echo "$line";done) > target.script

to copy the pasted command into a script file, and then run that script
afterwards. But the 'echo "$line"' introduced yet another level of
interpolation, so what started out as \0 turned into \\\\0000. You could
clean out your mouth several times over with that amount of toothpicks.


Frank disagreement binds closer than feigned agreement.

More information about the Digitalmars-d mailing list