Fair Warning! Don't use /tmp diretory in .pet packages

Post here if you feel others can duplicate your so discovered "bug"

Moderator: Forum moderators

Post Reply
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Fair Warning! Don't use /tmp diretory in .pet packages

Post by taersh »

Fair Warning!

No, this is not about the Van Halen album. It's dedicated to all Puppy developers who creates .pet packages using pinstall.sh scripts.

If a developer needs to use such pinstall.sh script e.g.to copy files from /tmp to another location -e.g. to avoid overwriting files already existing- don't do that. It will break the Puppy.

I don't know exactly when this had changed, though I experienced problems in FossPup64 9.5 after installing a .pet package having such a pinstall.sh script. It's because in FossaPup /tmp is a symbolic link which gets overwritten by the installed package.Therefore all the pup_event functions were removed. So, clicking a drive icon won't open drives/partitions anymore. The functions will return after restarting X, though anything else in /tmp still is lost - which perhaps might cause even more trouble when using save files or save folders.

Since the forum has no general developer section -at least I couldn't find one-, I decided to post this here.
Last edited by taersh on Mon Oct 05, 2020 4:28 pm, edited 1 time in total.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
Wiz57
Moderator
Posts: 497
Joined: Fri Dec 13, 2019 3:54 pm
Location: Chickasha, OK USA
Has thanked: 75 times
Been thanked: 81 times

Re: Fair Warning!

Post by Wiz57 »

Since the forum has no general developer section -at least I couldn't find one-, I decided to post this here
Hmmm, maybe that would be a good suggestion, add a new sub forum. In the "Programming" forum maybe?
Good catch, by the way...scripts need to implement measures to determine what data they add, and only
work with that, not what is linked to, already there, etc.
Brings back memories of late 1990s when I worked with Arachne for DOS...in some of the initial installer
batch files, if the "temp" variable was not set via config.sys or autoexec.bat, some installer script would
default to C:\DOS...then when the script finished, it would delete temp files, and subsequently EVERYTHING
in C:\DOS, leaving the computer inoperable, needing DOS reinstalled!
Wiz ;)

Signature available upon request

User avatar
MochiMoppel
Posts: 1142
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 374 times

Re: Fair Warning! Don't use pinstall scripts to make .pet packages

Post by MochiMoppel »

taersh wrote: Fri Oct 02, 2020 7:47 pmI don't know exactly when this had changed, though I experienced problems in FossPup64 9.5 after installing a .pet package having such a pinstall.sh script.
Which .pet package?
ozsouth
Posts: 1401
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 213 times
Been thanked: 617 times

Re: Fair Warning! Don't use pinstall scripts to make .pet packages

Post by ozsouth »

I wrote about overwriting /tmp in ScPup64 early this year. Is a symlink in that pup too.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Fair Warning! Don't use /tmp directory in .pet packages

Post by taersh »

MochiMoppel wrote: Sat Oct 03, 2020 12:56 am Which .pet package?
An older program I developed when I was working on L.A.S.S.I.E. - not published as far as I can recall.
Last edited by taersh on Mon Oct 05, 2020 4:30 pm, edited 1 time in total.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
greengeek
Posts: 1231
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 358 times
Been thanked: 148 times

Re: Fair Warning! Don't use pinstall scripts to make .pet packages

Post by greengeek »

Do you have any suggestions as an alternative to pinstall scripts?

Sometimes i want to do things before pet files are installed, but sometimes i want to do stuff after the pet files are installed.

I see Debian has two kinds of scripts for that purpose.

Some pets i have used for years on Slacko 5.6 fail during my recent experiments with Tahr32 etc (because of different timing handling pinstall scripts) so I am keen to know how to handle pet installation better.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Fair Warning! Don't use /tmp directory in .pet packages

Post by taersh »

"Don't use pinstall cripts to make .pet packages"

Sorry, but I didn't wrote this. The title I wrote was "Fair Warning" only.
My warning was meant to the /tmp directory inside of a .pet package.
E.g in FossaPup64 /tmp is a symbolic link which gets overwritten by the /tmp directory inside the .pet package.

The title has changed later, but it wasn't me.
I'm still using pinstall.sh, though I don't place it into a /tmp directory of the package.
Instead I'm creating another directory to place files to be installed by the pinstall.sh script.

Edit: I changed the title now.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
Jafadmin
Posts: 377
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 84 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by Jafadmin »

So, am I right in understanding that you mean, "Do NOT include a /tmp directory in your .pet package"?

If so, I'm struggling to understand why one WOULD do it to begin with :? .. '/tmp' is one of the reserved OS directories like /dev, /run, and /sys
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by taersh »

1. Directory /tmp is a directory for temporary files. This means it's for files temporarily stored.
There could be many purposes to store files temporarily into /tmp or into a sub-directory of /tmp.

It's completely stupid to look at it as a reserved OS directory, and it's even more stupid to define it being a reserved OS directory. ;)

A reserved OS directory should include content like it is in /dev, /proc, and /sys.
These directories obviously are not created/designed to store temporary files or even user files or even programs etc.

2. In older Puppies /tmp was a real directory. Not being a symbolic link like in the newer Puppies.
Even inside the initrd.gz, /tmp is still a real directory. And also inside of the base .sfs it is still a real directory.

And by the way: /run should also NOT being a reserved OS directory.
And by another way: /run is a symbolic link to /tmp in Puppy.

So, in newer Puppies somewhere within the boot process it changes to being a symbolic link.

My purpose of putting a /tmp directory into a .pet package is/was: installing files via .pet package and copying those files by the use of a pinstall.sh script. Within the pinstall.sh script I can make checks if the file is already existing, or if it is newer than the file in /tmp of the .pet package. So, that way I can avoid overwrite an existing/newer file. E.g. providing updates of a .pet package without to spare files out like .cfg files that may have changed by the user who already installed a first version.

I wrote:
If a developer needs to use such pinstall.sh script e.g.to copy files from /tmp to another location -e.g. to avoid overwriting files already existing- don't do that. It will break the Puppy.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
Jafadmin
Posts: 377
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 84 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by Jafadmin »

taersh wrote: Mon Oct 05, 2020 11:16 pm It's completely stupid to look at it as a reserved OS directory, and it's even more stupid to define it being a reserved OS directory. ;)
Read: https://www.fosslinux.com/41739/linux-t ... o-know.htm
User avatar
rcrsn51
Posts: 1251
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 291 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by rcrsn51 »

Even in old Puppies, using /tmp in a PET package was a problem. The /tmp folder needs full 1777 permissions so unprivileged processes (like in CUPS) can use it. Copying /tmp content out of a PET would often change it to 755.
User avatar
Jafadmin
Posts: 377
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 84 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by Jafadmin »

rcrsn51 wrote: Tue Oct 06, 2020 3:21 am Even in old Puppies, using /tmp in a PET package was a problem. The /tmp folder needs full 1777 permissions so unprivileged processes (like in CUPS) can use it. Copying /tmp content out of a PET would often change it to 755.
I had learned years back that the solution was to use /var/tmp
User avatar
rcrsn51
Posts: 1251
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 291 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by rcrsn51 »

Jafadmin wrote: Tue Oct 06, 2020 3:40 am I had learned years back that the solution was to use /var/tmp
It's exactly the same problem with /var/tmp. If a CUPS filter uses /var/tmp (some do) then it needs 1777 privileges too. So a PET that contains content in /var/tmp will cause trouble.
User avatar
Jafadmin
Posts: 377
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 84 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by Jafadmin »

rcrsn51 wrote: Tue Oct 06, 2020 12:07 pm
Jafadmin wrote: Tue Oct 06, 2020 3:40 am I had learned years back that the solution was to use /var/tmp
It's exactly the same problem with /var/tmp. If a CUPS filter uses /var/tmp (some do) then it needs 1777 privileges too. So a PET that contains content in /var/tmp will cause trouble.
But /var/tmp isn't a symlink, and both tmps are supposed to be 1777 by default.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by taersh »

Hi.

Thanks for all the useful knowledge being new to me.
Meanwhile I have edited most of my .pet packages.
Instead of /tmp or /var/tmp I'm using now my own hidden temporary directory in /root to do what I need by the pinstall.sh script.

Again thanks! :thumbup:

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
Jafadmin
Posts: 377
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 84 times

Re: Fair Warning! Don't use /tmp diretory in .pet packages

Post by Jafadmin »

Good plan! :thumbup2:
Post Reply

Return to “Bug Reports”