Not programming again... Command creates double path?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Not programming again... Command creates double path?

#1 Post by sunburnt »

The command I use to modify the binary exec. is creating double paths.

././/share/games/lbreakout2/gfx/././/share/games/lbreakout2/gfx/AbsoluteB/bricks.png

The command:

Code: Select all

find . -type f -exec sed -i -e "s|/usr|././|g" {} \;
It changes /usr to ././ in all the binary files it finds.
Last edited by sunburnt on Sun 10 Jun 2012, 07:26, edited 2 times in total.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#2 Post by jpeps »

Haven't we been down this road before? :)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

That was the initial problem, now it is having /share problems.

The command I use to modify the binary exec. is creating double paths.

././/share/games/lbreakout2/gfx/././/share/games/lbreakout2/gfx/AbsoluteB/bricks.png

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

s#/usr#\./\./# could end up in

/usr/share -> ././/share

I think you might be good at escaping dots for they are (posix?) regular expressions meaning one char .

Normally i could understand something like ../../ to make relative paths .

don't know if ././share will work .

sed can be a pain . sed uses the LANG=en_US environment, probably use "export LANG=C" OR "LC_ALL=C sed -i []" for some operations .

-e is needed if you combine multiple sedstrings; i don't use sed -e, i use sed 's[];s[]' the semicolon to add more commands to sed .

There had been problems on Lupu-52x with mount passing -n option to ntfs-3g, which had not been before. Maybe glibc has its differences (2.11.1<vs>2.11.2) and probably such things happen to sed too .

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post by Karl Godt »

And sed 's[]g' substitutes all patterns in a line GLOBALLY.

sed 's[]' without 'g' substitutes the first pattern in a line .

Note : LINE meaning ONE LINE , not the whole script .

Everything in the script gets changed using 'g' option to 's' command ,
while without 'g' every first pattern of all lines in script gets changed .

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

Hi again Karl; You`ve been a real busy guy around this Puppy forum!

I got the command at the Tiny Core forum, it`s used to make SCM files.
Replacing /usr with ././ has the same character count. but ends up as ././/

I too wondered how the mangled path could possibly work, but it does!
Seems like ././ would work okay, but // seems like it`d crash the path.

You run the command in the root dir. of a binary package and it "fixes" all
the /usr paths in all the binary exec. files in the package, exec. libs too.

What bugs me is that I had the LBreakout app. running, and it borked.
Now the "fix" command seems to mess up the path by doubling it.

The problem is with the share path, so I can`t fix it with LD_LIBRARY_PATH
like I just did with the Fox ToolKit package.

I rather like LBreakout, it`s great late night when your brain`s not working.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

Don't know anything about SCM files .
There seem to be a several .scm extensions :
http://www.fileinfo.com/extension/scm
?

Googling "SCM files" threw your Tiny Core adventure under the first 10 :
http://forum.tinycorelinux.net/index.php?topic=13221.0
and there seems to be another thread for SCM by yours .
It seems that nobody has much experience with SCM ..

*

To substitute " usr " with some " ././././ " there are several ways :

Code: Select all

s|/usr|\./\.|

Code: Select all

s|/usr/|\./\./|
where the second would be safer i think because that would filter /usrusrusretc/ directories ..

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

Thanks Karl; It looks like the fix command mangled the path badly.
It`s a first for it, I can`t figure out what`s different this time.
I`ve started with a clean slate of files and it does the same thing.

I`m going to lay it to the side for now and try to finish the SqApp tools.

I`m posting a problem with mksquashfs, it ignores hidden files.
Looking at the help, it says nothing about it. It seems kinda strange.

FIXED: Globbing does not include hidden files, don`t use "*", use ".".

Post Reply