Page 1 of 1

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

Posted: 2019-07-14, 03:51
by rmrichesjr
(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.

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

Posted: 2019-07-14, 05:31
by plushkava
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.

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

Posted: 2019-07-14, 08:24
by distantpluto
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 :)

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

Posted: 2019-07-14, 11:22
by therube
You don't necessarily need to use Profile Manager - at all.

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

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

Posted: 2019-07-14, 20:29
by Kruppt
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

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

Posted: 2019-07-18, 01:19
by Walter Dnes
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}

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

Posted: 2019-07-18, 01:23
by New Tobin Paradigm
Dnes is drunk again. He only tries to give linux advice when he is drunk.