[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regarding compilation of coreutils.
From: |
Kaz Kylheku (Coreutils) |
Subject: |
Re: Regarding compilation of coreutils. |
Date: |
Mon, 06 Jan 2020 21:56:26 -0800 |
User-agent: |
Roundcube Webmail/0.9.2 |
On 2020-01-06 11:53, Sandeep Kumar Sah wrote:
previously i edited ls.c to print "Hello World" before listing content
in a
directory.
Now i have deleted the coreutils folder and everything underneath it.
I want to get the original version of ls command for which i am unable
to
build the source file, it tells me that
"checking for a BSD-compatible install... /usr/local/bin/install -c
checking whether build environment is sane... configure: error: ls -t
appears to fail. Make sure there is not a broken
alias in your environment
configure: error: newly created file is older than distributed files!
Did you install this modified ls into your /bin?
Or is it in some non-system location that happens to be listed in your
PATH?
If you didn't clobber your system ls, so this is just a PATH issue,
either
edit PATH, or find out where this modified ls is and remove/rename it.
If you clobbered your /bin/ls, you may be able to use your GNU/Linux
distro's packaging system to refresh the installation.
Assuming you added something like:
printf("Hello, World\n");
to the code, then you can edit /bin/ls with a binary editor, such as,
oh, "vim -b /bin/ls". Find the "Hello World" string, and overwrite
the "H" with a null byte to reduce it to zero length. Save the
executable
and try it. If it's something like
puts("Hello, World");
where the newline is implicit in the function behavior, you may have
to find the instructions which make this call and overwrite them with
NOP (byte value 0x90 on Intel x86, IIRC).
Other ideas/hacks:
- Copy a working /bin/ls from another system that is identical or
similar to yours.
E.g. say you're on 64 bit Ubuntu 18. If you happen to have 64 bit
Ubuntu 16,
that system's /bin/ls should work.
- Go into the Coreutils configure system and try to
defeat the test for a working "ls -t". Maybe the result of the test
is not needed for the sake of building a working ls.
- Rename the funny ls binary to ls-funny, and write a /bin/ls shell
script wrapper which calls ls-funny "$@", and filters out the Hello,
World
first line of output, as in something like:
#!/bin/sh
/bin/ls-funny "$@" | sed -n -e '2,$p'
- Absolute last resort of the utter coward: Boot some rescue DVD-ROM.
Mount
your install partition and copy the live system's /bin/ls into your
install
partition's /bin/ls.