freememapplet_tray v2.8.6 and v2.8.6f - includes source

Core libraries and systems
Message
Author
gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Version 2.8.4 and 2.8.4x

#41 Post by gyro »

Added more validation of input from PUPSTATE to both.

Also added check for file existence to v2.8.4x, this brings its resilience to be on a par with v2.8.4.

V2.8.4x contains binaries this time. The other files can easily be copied from v2.8.4, if required.

Hopefully this is the end, well at least until someone else finds a bug.

gyro
Last edited by gyro on Sat 19 Sep 2015, 05:23, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#42 Post by MochiMoppel »

gyro, I don't know if I did something wrong, but when I try to run freememapplet_tray32 in Slacko5.6 I get a "SAVE_LAYER line is missing or badly formated." error.

I have no need for a SAVE_LAYER.
My /etc/rc.d/PUPSTATE reads

Code: Select all

PUPMODE=5
PDEV1='sdb1'
DEV1FS='vfat'
PUPSFS='sdb1,vfat,/pup_slacko/puppy_slacko_5.6.sfs'
PUPSAVE=''
PMEDIA='usbflash'
#ATADRIVES is all internal ide/pata/sata drives, excluding optical, excluding usb...
ATADRIVES='sda '
#ATAOPTICALDRIVES is list of non-usb optical drives...
ATAOPTICALDRIVES='sr0 sr1 '
#these directories are unionfs/aufs layers in /initrd...
SAVE_LAYER=''
PUP_LAYER='/pup_ro2'
#The partition that has the slackosave file is mounted here...
PUP_HOME=''
#(in /initrd) ...note, /mnt/home is a link to it.
#this file has extra kernel drivers and firmware...
ZDRV=''
#complete set of modules in the initrd (moved to main f.s.)...
ZDRVINIT='no'
#Partition no. override on boot drive to which session is (or will be) saved...
PSAVEMARK=''
PSUBDIR='/pup_slacko'

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#43 Post by 01micko »

Hi MochiMoppel

Indeed it looks all along as if the case for pupmode=5 has just been testing '/initrd' without adding anything in the concatenation (nothing to add). Of course testing any valid writeable directory in the system would give the same amount of space available (which when running fully in RAM would be whatever RAM is left).

I propose this patch to add a case for pupmode=5 (this is against 2.8.4x)

Code: Select all

--- freememapplet_tray.c.x	2015-09-18 10:18:30.000000000 +1000
+++ freememapplet_tray.c	2015-09-18 15:32:37.853326180 +1000
@@ -55,6 +55,7 @@
 
 gboolean pupSavefile = FALSE;
 gboolean fullInstall = FALSE;
+gboolean firstRun = FALSE;
 
 gboolean Update(gpointer ptr);
 
@@ -79,7 +80,7 @@
 gboolean Update(gpointer ptr) {
 	
     //read free personal storage...
-	if (fullInstall)
+	if ((fullInstall) || (firstRun))
 		getFileSystemData("/");
 	else
 		getFileSystemData(save_layer_dir);
@@ -220,6 +221,10 @@
 					fullInstall = TRUE;
 					haveSaveLayer = TRUE;
 				}
+				else if (g_str_has_suffix(curLine, "=5"))
+				{
+					firstRun = TRUE;
+				}
 			}
 			else if (g_str_has_prefix(curLine, "PUPSAVE="))
 			{
@@ -262,7 +267,7 @@
 	g_free(linesString);
 	g_strfreev(linesArray);
 
-	if ((havePupstate) && (haveSaveLayer))
+	if ((havePupstate) && ((haveSaveLayer) || (firstRun)))
 	{
 		gtk_init(&argc, &argv);
 		tray_icon = create_tray_icon();
Puppy Linux Blog - contact me for access

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

#44 Post by gyro »

Hi MochiMoppel,

Yes it's complaining that there's nothing in "SAVE_LAYER". It won't do just "/initrd" anymore.

Would it make sense to set "save_layer_dir" to "/" if there is a PUPSTATE file but the SAVE_LAYER value is empty?

Note: The exit versions have a problem if "getFileSystemData" returns 0, the following code:

Code: Select all

if (sizefreeprev == sizefree)
		return TRUE; //unchanged.
means that the icon is never setup, so the program is in the tray, but it's just a blank. A right click on the spot it should be in produces a menu. Not good.
So it's quite important to make sure that there is always a valid value for "save_layer_dir" before it is decided not to exit.

gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#45 Post by 01micko »

gyro wrote:Would it make sense to set "save_layer_dir" to "/" if there is a PUPSTATE file but the SAVE_LAYER value is empty?
Yes.
I wrote:Of course testing any valid writeable directory(snip)
Which would by definition exclude any mount points.
Puppy Linux Blog - contact me for access

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

#46 Post by gyro »

Hi 01micko,

If a boolean was to be used in similar way to your suggested code, I would be considering using a single variable "use_root_as_dir" instead of both "fullInstall" and "firstRun";

gyro

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

#47 Post by gyro »

Hi 01micko,

"save_file_dir" doesn't have to be a writeable directory, in fact it just has to be an existing file in the relevant partition.

I will produce another "x" version that has no special pupmode testing, but uses "/" if it can't get anything from "SAVE_LAYER".

gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#48 Post by 01micko »

gyro wrote:Hi 01micko,

"save_file_dir" doesn't have to be a writeable directory, in fact it just has to be an existing file in the relevant partition.

I will produce another "x" version that has no special pupmode testing, but uses "/" if it can't get anything from "SAVE_LAYER".

gyro
That should work.

Thanks for your efforts.
Puppy Linux Blog - contact me for access

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

Version 2.8.5x

#49 Post by gyro »

This version exits if it can't find a PUPSTATE file.
It also exists if there is no SAVE_LAYER line or if there is a directory specified by the SAVE_LAYER line but it does not exist.

Note: In a frugal install if "/" is used, it shows the partition of "pup_rw". In pupmode=5 and pupmode=13 I think that this is the tempfs that contains "pup_rw".

gyro
Last edited by gyro on Sat 19 Sep 2015, 05:15, edited 1 time in total.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#50 Post by 01micko »

We just did a circle :lol:

Again now failing in full installs due to lack of "SAVE_LAYER" line.
Puppy Linux Blog - contact me for access

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

#51 Post by gyro »

01micko wrote:Again now failing in full installs due to lack of "SAVE_LAYER" line.
Not a big problem, provided that it has a PUPSTATE file.
It does have a PUPSTATE file does't it??
gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#52 Post by 01micko »

gyro wrote:
01micko wrote:Again now failing in full installs due to lack of "SAVE_LAYER" line.
Not a big problem, provided that it has a PUPSTATE file.
It does have a PUPSTATE file does't it??
gyro
yes.
Puppy Linux Blog - contact me for access

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

Version 2.8.6x

#53 Post by gyro »

Yet another version.

This one exits if there is no PUPSTATE file.
If it gets something from the "SAVE_LAYER" line then it must result in an existing file, if not it exits.
If it doesn't get anything from a "SAVE_LAYER" line then it uses "/".

This means that it strongly protects itself from the dreaded zero.

Under pupmode=12, the result will be the same if it gets a valid '/pup_rw' or it uses '/', since '/' means it uses the aufs write layer which is the savefile/savefolder.

Under pupmode=13, a valid '/pup_ro1' will give information on the savefile/savefolder. But if it uses '/' then it will give information on the tmpfs that contains 'pup_rw'.

Again the tar file includes some binaries.

gyro

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

Version 2.8.6x

#54 Post by gyro »

Seems I forgot to attach the file.
gyro
Attachments
freememapplet-2.8.6x.tar.gz
extract to directory
(12.1 KiB) Downloaded 223 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#55 Post by 01micko »

Passed my tests in pupmodes 2, 5 and 12 (with savfile and savefolder).

Thanks
Puppy Linux Blog - contact me for access

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

#56 Post by gyro »

01micko,

Thanks for testing, I'll put it on the first post as version 2.8.6 as a complete package.

gyro

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

#57 Post by gyro »

It's done.
Please see latest Edit at the beginning of the first post.
gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#58 Post by 01micko »

Hi gyro

Well I reckon this is the end of development as it seems stable throughout different installations.

I took the liberty to upload 2.8.6 to ibiblio sources <<-- http://distro.ibiblio.org/puppylinux/so ... .6.tar.bz2. This was mainly to facilitate downloading and building from a script.

All I did was strip out the binaries and pot files and rebuilt the archive with bz2 compression to distinguish from your package.

If you don't mind, I'd like to make a post in the translations section so we can get some .po files for different languages, or you can do it if you like.

Thanks again for your efforts.
Puppy Linux Blog - contact me for access

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#59 Post by MochiMoppel »

Provided binary seems to run OK in Slacko5.6 (after creating /usr/share/pixmaps/puppy and copying the .svg files).

However what I always find irritating in new puppies is the strange "full green" icon (container_4.svg), right in the screenshot. Looks empty to me because the opaqueness is wrong when compared with the "almost full" icon (container_3.svg). I like the old one (left in screenshot) much better and would like to keep it when - some day - upgrading to a newer Puppy. My question: Where does Slacko5.6 store these icons? I can't find them :cry:
Attachments
freemem_icons.png
(1.77 KiB) Downloaded 166 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#60 Post by 01micko »

They are builtin. XPM's can be included in C source. I'll attach them for you, but you'll have to change the icon names in the source.
Attachments
freemem_xpm.tar.gz
(557 Bytes) Downloaded 215 times
Puppy Linux Blog - contact me for access

Post Reply