WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tce.install, tce-load, submitqc ...  (Read 2670 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
tce.install, tce-load, submitqc ...
« on: August 28, 2023, 11:29:40 AM »
Yes, I'm bringing this topic up again.
I just go over the Core-scripts, grepping through all the files.
It turns out, the only script that would ever care about the permission of that directory, is you guess it tce-load:P
The directory is setup by /etc/init.d/tc-config
Code: [Select]
chgrp staff "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"
chmod g+w "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"

After that, nobody cares.
Every scripts which has that infamous directory in it only checks if a certain app has been loaded.
As for the only script who cares, tce-load can be easily patched by adding a simple "sudo".
Or if you really like the way it is, just add a few lines in tce-load to reset the "right permission".
Code: [Select]
if [ -x "$TCEINSTALLED"/$2 ]; then
if [ "$BOOTING" ] ; then
echo "$TCEINSTALLED"/$2 >> /tmp/setup.lst
else
sudo "$TCEINSTALLED"/$2
fi
else
- touch "$TCEINSTALLED"/$2
+ sudo touch "$TCEINSTALLED"/$2
fi
I'm not quite sure if everyone is OK with that, since old habit die hard.
What I'm suggesting, is to patch tce-load, then everybody can be happy.
A root:root tce.installed would be just fine, the startup scripts are run by super user anyway.
Maybe not now, but future release like TC14.1 or TC15.

I'm bringing all this up because I found a bug in submitqc.
It change the permission back and forth if run multiple times.
Spent a few minutes, found the cause, just legacy code that got left behind over the years.
I can patch it, of course, but I wanna have a definite final conclusion before I do the patching.

Do we keep this old habit for no apparent benefit ?
Or I should just fix the bug in submitqc instead of a one-liner hack to tce-load ?  :P
« Last Edit: August 28, 2023, 11:32:38 AM by polikuo »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11040
Re: tce.install, tce-load, submitqc ...
« Reply #1 on: August 28, 2023, 12:21:05 PM »
I'm not sure I understand, what is the issue?
The only barriers that can stop you are the ones you create yourself.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Re: tce.install, tce-load, submitqc ...
« Reply #2 on: August 28, 2023, 12:45:38 PM »
Simply put.

I'm packing extensions.

Got annoyed that submitqc kept reporting wrong permission with the startup script (tce.installed)

Check submitqc and found bugs, need careful examination.

Check Core-scripts and found the only script that cares is tce-load.

An easy fix to tce-load can be done without causing any trouble.

Propose to hack tce-load so we don't have to care about tce.installed permission anymore.

Not necessarily right now, perhaps for a future release.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: tce.install, tce-load, submitqc ...
« Reply #3 on: August 28, 2023, 01:24:17 PM »
Hi polikuo
... The directory is setup by /etc/init.d/tc-config
Code: [Select]
chgrp staff "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"
chmod g+w "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"
...
I believe the reason for setting  group  to  staff  is because  user  can vary
from install to install based on preference, but all users should belong to
the  staff  group. Personally, I don't feel a user should need to invoke root
privileges if they wish to manually make changes to  $TCEDIR  for example.

Quote
... I'm bringing all this up because I found a bug in submitqc.
It change the permission back and forth if run multiple times. ...
That's not good.

Quote
... Spent a few minutes, found the cause, just legacy code that got left behind over the years. ...
Maybe post the offending section of code to get a few more eyes on it. If it
doesn't belong, then it can be removed.

Quote
... I can patch it, of course, but I wanna have a definite final conclusion before I do the patching. ...
If it's a bug in submitqc, then that's where it should probably be fixed.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 706
Re: tce.install, tce-load, submitqc ...
« Reply #4 on: August 28, 2023, 02:46:41 PM »
Why setting up the rights after untar ??
Or do tar have some options to always extract the files with very specific rights.
That can overload the archive one.
What i can see, in gnu tar you can do something like this. But this is for making the tar.
Code: (bash) [Select]
tar -c -f archive.tar --owner=0 --group=0 --no-same-owner --no-same-permissions .But i donĀ“t know if busybox tar support that.

Why not setting the correct rights in the tar archive.

And checking the correct rights in submitqc script.
Before you can submit the extension.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1238
Re: tce.install, tce-load, submitqc ...
« Reply #5 on: August 28, 2023, 08:05:10 PM »
That touch command is the only command that I have ever seen fail due to an extension jumbling up the permissions of /usr/local/tce.installed

Normally I would say adding a sudo in a script is not a good idea if we can avoid it, but there is already 13 sudo commands in tce-load.   What's the harm in one more.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Re: tce.install, tce-load, submitqc ...
« Reply #6 on: August 28, 2023, 10:46:17 PM »
Why setting up the rights after untar ??
Actually, the command used in tce-load is
Code: [Select]
yes "$FORCE" | sudo /bin/cp -ais /tmp/tcloop/"$APPNAME"/* / 2>/dev/nullThe $FORCE variable is "n" in normal mode, thus doesn't overwrite an existing file.
If you load an app with force flag (tce-load -f -i app), the variable switch to "y".

That touch command is the only command that I have ever seen fail due to an extension jumbling up the permissions of /usr/local/tce.installed

Normally I would say adding a sudo in a script is not a good idea if we can avoid it, but there is already 13 sudo commands in tce-load.   What's the harm in one more.

I totally agree with you.
What's the harm if it saves you more trouble.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11040
Re: tce.install, tce-load, submitqc ...
« Reply #7 on: August 29, 2023, 01:44:18 AM »
Yes, adding sudo to the touch for the next release should be fine. But submitqc should also be fixed.
The only barriers that can stop you are the ones you create yourself.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Re: tce.install, tce-load, submitqc ...
« Reply #8 on: August 29, 2023, 12:56:33 PM »
Hi, I'm still working on fixing submitqc
The script doesn't seem to handle the ownership of the top directory very well.
Just a few line so you could get the idea.
Code: [Select]
$ ls -l /tmp/tcloop/
drwxr-xr-x    3 tc       staff           26 Aug  9 09:55 mylocale
drwxr-xr-x    3 tc       staff           26 Mar 16  2014 wifi
drwxr-xr-x    4 root     staff           37 May  6 23:40 wireless-6.1.25-piCore-v7
drwxr-xr-x    4 root     root            37 May  1 01:44 openssl
$ busybox ls -ld /
drwxrwxr-x   17 root     root           380 Jan  1  1970 /

The / is immune to changes, even if you load a file that has tc:staff at the top.

Suggestion ?
Should we care about it or should I just get rid of that from the check list ?

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: tce.install, tce-load, submitqc ...
« Reply #9 on: August 29, 2023, 01:48:30 PM »
Hi polikuo,

Code: [Select]
tc@box:~$ ls -ld /
drwxr-xr-x   17 tc       staff          380 Apr 12 18:43 /
tc@box:~$ uname -a
Linux box 6.1.2-tinycore #612 SMP Mon Jan  2 16:44:20 UTC 2023 i686 GNU/Linux
Where are You?

EDIT: Well, I think no matter what TC You are running, the matter is whether Your onboot.lst is empty or not. In my case it is not empty, and number of extensions are installed during tce-setup called from tc-config as root.
« Last Edit: August 29, 2023, 02:09:28 PM by jazzbiker »