Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 01 Aug 2014, 12:34
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Not programming again... Command creates double path?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Sun 10 Jun 2012, 01:00    Post subject:  Not programming again... Command creates double path?  

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:
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, 03:26; edited 2 times in total
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 10 Jun 2012, 01:46    Post subject:  

Haven't we been down this road before? Smile
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Sun 10 Jun 2012, 03:23    Post subject:  

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
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Sun 10 Jun 2012, 07:12    Post subject:  

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 .
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Sun 10 Jun 2012, 07:22    Post subject:  

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 .
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Sun 10 Jun 2012, 10:59    Post subject:  

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.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Sun 10 Jun 2012, 15:19    Post subject:  

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:
s|/usr|\./\.|

Code:
s|/usr/|\./\./|


where the second would be safer i think because that would filter /usrusrusretc/ directories ..
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Sun 10 Jun 2012, 20:46    Post subject:  

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 ".".
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0558s ][ Queries: 11 (0.0040s) ][ GZIP on ]