Please note: we have made some forum changes regarding user data and privacy.
More info here: Planned downtime for the forum and changes.

Any reasons a symlink won't work for profile directories?

Support and discussions for the x86/x64 Linux version of Pale Moon.

Moderators: trava90, satrow

Post Reply
User avatar
rmrichesjr
Newbie
Newbie
Posts: 4
Joined: 2019-06-14, 03:37

Any reasons a symlink won't work for profile directories?

Post by rmrichesjr » 2019-07-14, 03:51

(Long-time Linux user, new to Pale Moon, coming from Firefox.)

I have some scripts that need to do 'find' of a filename ('lock' for example) inside the browser's profile tree. Some of those scripts don't work well with the spaces in directory names '.moonchild productions' and 'pale moon'. I also manually do 'find' and 'du' and 'ls' commands on a fairly frequent basis to look around the profile tree (to find disk space usage anomalies, for example). The spaces in the directory names make those operations less convenient. A search of this forum found these topics:

viewtopic.php?f=37&t=21441&p=161847&hil ... me#p161847

viewtopic.php?f=37&t=17108&p=125311&hil ... me#p125311

From those topics, I understand that Pale Moon is hardcoded to look in "$HOME/.moonchild productions/pale moon" for profiles and there's no option to change that path to avoid the spaces in the directory names.

Rather than rewrite _every_ _one_ of my affected scripts to tolerate spaces in directory names '.moonchild productions' and 'pale moon', I'd like to try renaming the two directories with a hyphen instead of a space and then create a near-twin symlink for each so that the real path is "$HOME/.moonchild-productions/pale-moon" but the symlinks cause "$HOME/.moonchild productions/pale moon" to end up in the same place.

Are there any known reasons that won't work? Or, in other words, has anyone here already tried it and found reasons it won't work? If so, what are those reasons?

Thank you.

User avatar
plushkava
Apollo supporter
Apollo supporter
Posts: 41
Joined: 2015-07-31, 04:53
Location: United Kingdom

Re: Any reasons a symlink won't work for profile directories?

Post by plushkava » 2019-07-14, 05:31

rmrichesjr wrote:
2019-07-14, 03:51
From those topics, I understand that Pale Moon is hardcoded to look in "$HOME/.moonchild productions/pale moon" for profiles and there's no option to change that path to avoid the spaces in the directory names.
That's correct. Its unfortunate that a space is included but the status quo appears unlikely to change.
rmrichesjr wrote:
2019-07-14, 03:51
Rather than rewrite _every_ _one_ of my affected scripts to tolerate spaces in directory names '.moonchild productions' and 'pale moon', I'd like to try renaming the two directories with a hyphen instead of a space and then create a near-twin symlink for each so that the real path is "$HOME/.moonchild-productions/pale-moon" but the symlinks cause "$HOME/.moonchild productions/pale moon" to end up in the same place.

Are there any known reasons that won't work? Or, in other words, has anyone here already tried it and found reasons it won't work? If so, what are those reasons
Firstly, you really should fix your scripts. Quoting variable expansions isn't merely a matter of correctly handling paths with spaces. Quoting protects against other forms of expansion from being applied to the variable's value and is vital from a standpoint of correctness and safety. Testing your scripts with shellcheck.net and focusing on the SC2086 warning would ease the burden of doing this.

Secondly, I'm not aware of any reason for the strategy that you describe not to work. I just gave it a quick try and Pale Moon seemed happy to follow "$HOME/.moonchild productions/pale moon" in its capacity as a symlink. That said, symlinks are obviously not directories and I have very occasionally encountered applications in the past that exhibit side-effects when operating on symlinks instead of directories. I would not personally trust Pale Moon never to exhibit any side effects. Therefore, you might also consider inverting your intended strategy:

Code: Select all

cd &&
mkdir .moonchild-productions &&
cd .moonchild-productions &&
ln -s "../.moonchild productions/pale moon" pale-moon
That way, the canonical path remains a real directory. However, you would then likely need to make some minor changes to your scripts. For example, find needs the -L option if the "starting point" is specified and happens to be the path to a symlink.

distantpluto
Apollo supporter
Apollo supporter
Posts: 46
Joined: 2015-12-17, 18:28
Location: UK

Re: Any reasons a symlink won't work for profile directories?

Post by distantpluto » 2019-07-14, 08:24

rmrichesjr wrote:
2019-07-14, 03:51
Are there any known reasons that won't work? Or, in other words, has anyone here already tried it and found reasons it won't work? If so, what are those reasons?
I've always used a symlink for Firefox (when I used it way back), Thunderbird and Pale Moon profile directories. No issues here.
plushkava wrote:
2019-07-14, 05:31
Firstly, you really should fix your scripts. Quoting variable expansions isn't merely a matter of correctly handling paths with spaces. Quoting protects against other forms of expansion from being applied to the variable's value and is vital from a standpoint of correctness and safety. Testing your scripts with shellcheck.net and focusing on the SC2086 warning would ease the burden of doing this.
This, as plushkava says. As a long time Linux user I'm absolutely amazed you're not already doing it! Spaces are not an issue :)

User avatar
therube
Board Warrior
Board Warrior
Posts: 1101
Joined: 2018-06-08, 17:02

Re: Any reasons a symlink won't work for profile directories?

Post by therube » 2019-07-14, 11:22

You don't necessarily need to use Profile Manager - at all.

You can use the -profile switch to point to a profile location.

User avatar
Kruppt
Moongazer
Moongazer
Posts: 12
Joined: 2018-07-23, 22:32

Re: Any reasons a symlink won't work for profile directories?

Post by Kruppt » 2019-07-14, 20:29

I keep the original directories along original path like so:
/home/YOUUSERNAME/.moonchild productions/pale moon/profiles.ini
but only the profile.ini file resides there.
The stanzas within the profile.ini point to the
the real locations of my profile directories which have been
renamed to eliminate the spaces.
As an example:

Code: Select all

[General]
StartWithLastProfile=0

[Profile0]
Name=Palemoon-24
IsRelative=0
Path=/home/YOURUSERNAME/.moonchild-productions/pale-moon/whatever.default

[Profile1]
Name=Palemoon-27-firejail
IsRelative=0
Path=/home/YOURUSERNAME/.moonchild-productions/pale-moon/whatever.27-firejail

[Profile2]
Name=Palemoon-28-firejail
IsRelative=0
Path=/home/YOURUSERNAME/.moonchild-productions/pale-moon/whatever.28-firejail

Walter Dnes
Astronaut
Astronaut
Posts: 610
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Any reasons a symlink won't work for profile directories?

Post by Walter Dnes » 2019-07-18, 01:19

I do homebrew builds for a few machines at home (desktops and a laptop). To save space, avoid downloading multiple copies of source, avoid maintaining multiple build scripts, etc, I use symlinks. I can't duplicate it now, but I do remember once having run into strange results when using relative pathnames, while jumping around in symlinked directories. To guard against this, I use absolute pathnames, storing them in a variable. E.g. in my build script (bash) I start off with
startdir="${PWD}"

The build scipt contains a few references to the startdir

export builddir="${startdir}/pmbuild"
./mach build &> /dev/stdout | tee ${startdir}/buildlog.txt
./mach package &> /dev/stdout | tee ${startdir}/packagelog.txt
cd ${startdir}
There's a right way
There's a wrong way
And then there's my way

User avatar
New Tobin Paradigm
Off-Topic Sheriff
Off-Topic Sheriff
Posts: 6209
Joined: 2012-10-09, 19:37
Location: Sector 001

Re: Any reasons a symlink won't work for profile directories?

Post by New Tobin Paradigm » 2019-07-18, 01:23

Dnes is drunk again. He only tries to give linux advice when he is drunk.
Image
- Old and insecure for legitimate and reasonable purposes. -
http://binaryoutcast.com/ | http://thereisonlyxul.org/ | Freenode #binaryoutcast

User avatar
Mike_Walsh
Hobby Astronomer
Hobby Astronomer
Posts: 19
Joined: 2019-09-14, 20:09
Location: King's Lynn, UK

Re: Any reasons a symlink won't work for profile directories?

Post by Mike_Walsh » 2019-09-25, 17:50

Interesting. I have to confess that the 'standard' profile location appears to be modifiable quite easily.

Over at the Puppy Linux forums, we turn bog-standard releases of Palemoon into 'portable' versions by the simple addition of a small script, that has been 'floating' around the web for years. This script was probably developed for Firefox itself, yet it seems to work for the majority of all Mozilla-related browsers. This script makes use of the '-profile' flag; it creates a sub-directory within the Palemoon directory, simply called 'profile'. The browser is then told to create its profile within this sub-directory instead, and to always look here to find it. And it seems to work as well with Palemoon as it does any of the others.

'Portable' has a somewhat different meaning for Puppy, compared to most other distros. For Puppy, a 'portable' application is any app which lives outside of the user's 'save-file' in its entirety (this is where the user's personal configurations/customizations are kept) - the object in Puppy-land being to keep this item (the 'save-file') as small as is humanly possible, given that many Puppy users use truly ancient, often low-powered & RAM-challenged hardware.....

You can see an example of this 'launch' script here:-

https://forum.palemoon.org/viewtopic.php?p=174936#p174936

I, personally, use this method to share a single instance of the browser between multiple Puppies in my kennels - currently running 11 of them.


Mike. ;)

Post Reply