problem with "init" script in Slacko 5.7 and likely others

Please post any bugs you have found
Post Reply
Message
Author
gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

problem with "init" script in Slacko 5.7 and likely others

#1 Post by gyro »

Recently I've been playing with the "init" scripts of both Slacko 5.7 and Dpup Wheezy 3.5.2.11. I did the testing on Slacko, but the 'init' script for Wheezy has identical code in the relevant places. So I think that the problem is not peculiar to Slacko.

Problem:
if you look at the "find" code, (in Slacko line 520)

Code: Select all

    [ "$FND_PUPSAVES" = "" ] && FND_PUPSAVES="`find /mnt/data -maxdepth 1 -xdev -type f -iname ${DISTRO_FILE_PREFIX}save*.[234]fs | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
It appears that even if puppy is installed in a psubdir, the save file can be in the root of the partition.
I did a fresh frugal install of Slacko in a psubdir on an ext3 partition.
I rebooted a couple of times to ensure that the save file was stable and working.
Using a different puppy on the same machine, I moved the save file from the psubdir to the root of the partition, and rebooted into my test Slako.
Lo, the save file was not used, it booted into pupmode 5.

On investigation I found that the save file had been found by the "find" code, as it was in "/initrd/tmp/PUPSAVES-complete". But it appears to have been discarded by the following code, (line 907 in Slacko 5.7)

Code: Select all

   grep "${PSUBDIR}/" /tmp/PUPSAVES > /tmp/PUPSAVES2 #note: need this as above probing may have got some invalid hits.
So, what's the point in "find"ing the save file, if it's only going to be ignored?

Possible fixes:
1) Remove the apparently useless "find" code.
2) Remove the code that discards perfectly good save files.
3) Fix the discarding code so that it doesn't throw away good stuff.

1) and 2) look quite doable.
3) I've no idea, because I don't know what bad stuff it's trying to discard.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#2 Post by mavrothal »

When the find is done, puppy does not know the boot arguments, so it finds all possible savefiles.
When the boot arguments is presented then the other savefiles are ignored.
One could add the option for additional savefiles to be considered if no savefiles are found in the puppy_folder but I believe that the option was added exactly so other savefiles will be ignored when puppy is installed in a folder.
Of course the search could be done after boot arguments were considered but given the plurality of puppy installation option and progressive developemt, I guess the idea was "find everything and eliminate latter".
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#3 Post by gyro »

mavrothal wrote:When the find is done, puppy does not know the boot arguments, so it finds all possible savefiles.
When the find is being done, it certainly knows about psubdir.

gyro

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#4 Post by bigpup »

I remember something being changed in the code to control which save file gets used for what.

The thinking was if Puppy is installed to a directory all the Puppy files for it should be in that directory. If something was found outside that directory, it was not for that install, so needed to be ignored.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#5 Post by gyro »

bigpup wrote:The thinking was if Puppy is installed to a directory all the Puppy files for it should be in that directory. If something was found outside that directory, it was not for that install, so needed to be ignored.
That's fine, but then why bother "find"ing it in the first place?
gyro

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#6 Post by mikeb »

You question the logic until you realise there probably was none.. ;)

mike

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#7 Post by slavvo67 »

Ouch! That one hurt!

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#8 Post by bigpup »

A lot of Puppy code was hacked, as needed, to fix a problem.
No one ever took the time to rewrite the whole thing.
As long as the code change, worked, and did not break something else, that was all that was done.
This is an example of such hacking.

Barry K. was the main individual that controlled this.
He has moved on and left the building.

The only real testing of code is by us users.
The only real code changes are made by, again, us.

If you think you have a better way.
Code away.

We will help if we can.

Submit for inclusion into Woof-CE when you are done.

What Puppy does or does not do is all up to us.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#9 Post by mikeb »

Indeed... and projects like the save directory are opportunities to re look at the code.

I suppose the comparison is of the average cities developement growing from a small hamlet to urban sprawl with short term cludges in design along the way.

Out of the ashes the pheonix rises.....

mike

Post Reply