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 Sat 25 Oct 2014, 02:43
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 Posts_count  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5037
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.

Edited_times_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: 5037
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: 3972
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_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
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_website 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
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: 3972
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_website 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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