LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Current64: Where does the /.cache file come from? (https://www.linuxquestions.org/questions/slackware-14/current64-where-does-the-cache-file-come-from-4175605075/)

rworkman 05-05-2017 09:18 AM

Quote:

14:12 < rworkman> Without any debugging, looks like it's in glib/gutils.c probably
14:14 < rworkman> in g_get_user_runtime_dir()
I've made an inquiry of mclasen, the guy who does glib releases; let's wait and see what he says before any significant time is invested in debugging...

rworkman 05-05-2017 09:29 AM

In the meantime, something like this near the top of rc.networkmanager should move the problem somewhere other than /:
Code:

XDG_CACHE_HOME=/run
export XDG_CACHE_HOME


rworkman 05-05-2017 09:37 AM

Quote:

Originally Posted by allend (Post 5706554)
This is working for me to stop the creation of /.cache directory.
Code:

bash-4.4$ diff ./a/rc.networkmanager ./b/rc.networkmanager
36c36
<  $NETWORKMANAGER_BIN
---
>  XDG_CACHE_HOME=/root/.cache $NETWORKMANAGER_BIN

From https://standards.freedesktop.org/ba...ec-latest.html

Crap, I just saw this. Yes, this is a nice workaround and essentially what I reposted.

burdi01 05-05-2017 11:08 AM

Quote:

Originally Posted by allend
This is working for me to stop the creation of /.cache directory.
Code:

bash-4.4$ diff ./a/rc.networkmanager ./b/rc.networkmanager
36c36
<  $NETWORKMANAGER_BIN
---
>  XDG_CACHE_HOME=/root/.cache $NETWORKMANAGER_BIN

Crap, I just saw this. Yes, this is a nice workaround and essentially what I reposted.
Confirmed to resolve (work around?) the issue for me too.
:D :D :D

allend 05-25-2017 11:24 AM

Grr - This issue is back in -current with the latest NetworkManager-1.8.0 which silently overwrote my existing /etc/rc.d/rc.networkmanager on upgrade.

rworkman 05-25-2017 01:10 PM

Quote:

Originally Posted by allend (Post 5715080)
Grr - This issue is back in -current with the latest NetworkManager-1.8.0 which silently overwrote my existing /etc/rc.d/rc.networkmanager on upgrade.

I don't see how it overwrote your rc.networkmanager :/

allend 05-26-2017 03:25 AM

The problem is in this function of the doinst.sh
Code:

preserve_perms() {
  NEW="$1"
  OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
  if [ -e ${OLD} ]; then
    cp -a ${OLD} ${NEW}.incoming
    cat ${NEW} > ${NEW}.incoming
    mv ${NEW}.incoming ${NEW}
  fi
  mv ${NEW} ${OLD}
}

The old file is copied, then immediately overwritten.
Perhaps
Code:

cp -a ${OLD} ${OLD}.orig

GazL 05-26-2017 03:35 PM

preserve_perms() usually has a config $NEW rather than a mv $NEW $OLD where files are to be treated as config files and left for the user to manage. It would probably be more in keeping with the slackware way of doing things to do that than creating a *.orig in this case.

USUARIONUEVO 05-26-2017 09:04 PM

The .cache folder is using by some apps or services.

In my $HOME/.cache i have some folders like gstreamer-1.0 , obexd , google-crome , and others.

Is not an error ,some apps, want this ,if no exists "create a new one".

Thats all.

Didier Spaier 05-26-2017 09:16 PM

Quote:

Originally Posted by USUARIONUEVO (Post 5715738)
The .cache folder is using by some apps or services.

In my $HOME/.cache i have some folders like gstreamer-1.0 , obexd , google-crome , and others.

Is not an error ,some apps, want this ,if no exists "create a new one".

Thats all.

This thread is about /.cache, not ~/.cache as reminded by the OP is post #10

PS The XDG Base Directory Specification states:
Quote:

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.
But no user should have / as $HOME

Didier Spaier 05-26-2017 09:52 PM

@burdi01:from the ChangeLog for Slackware-Current:
Code:

Fri May 26 22:40:13 UTC 2017
<snip>
  rc.networkmanager: Set XDG_CACHE_HOME=/root/.cache before starting.
  Thanks to allend.

Thus I assume that this thread could be marked as [SOLVED]

PS This complies to the XDG Base Specification as reminded by my previous post. Sounds logical as our friend LP is both NM's author and a co-author of the spec :D(1)

PPS I just checked: when /etc/rc/d.rc.M starts rc.networkmanager, $HOME is set to "/". I have no idea on why nor what sets it, but that sounds weird as POSIX states:
Code:

HOME
    The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See <pwd.h>.

But as nobody is logged in when rc.M starts rc.networkmanager, why is HOME already set?

Anyway as rc.M runs on behalf of root, setting XDG_CACHE_HOME as /root/.cache in rc.networkmanager is indeed the right thing to do.

EDIT (1) No LP is not author of NM, sorry for this mistake. As we say here on ne prête qu'aux riches.

burdi01 05-27-2017 04:26 AM

I still cannot help feeling that this solution is working around the problem rather that resolving the cause.
Anyway, marking this thread as solved.
Thks everyone.
:D

Edit: Hmm, when reading back this post I notice that it sounds more negative than I meant it to be.

GazL 05-27-2017 04:32 AM

Quote:

Originally Posted by burdi01 (Post 5715828)
I still cannot help feeling that this solution is working around the problem rather that resolving the cause.
Anyway, marking this thread as solved.
Thks everyone.
:D

Edit: Hmm, when reading back this post I notice that it sounds more negative than I meant it to be.

Yes, it does feel kind of ugly, but then, that's NetworkManager for you.

Didier Spaier 05-27-2017 04:48 AM

Quote:

Originally Posted by GazL (Post 5715830)
Yes, it does feel kind of ugly, but then, that's NetworkManager for you.

Well NM just does what's written in the aforementioned spec. How is that wrong or ugly?

The alternative would be that if HOME is set to / NM sets it to /root. I wouldn't like that at all, as it would be too much intrusive: it's simply not NM's job to set HOME. Doing that in the startup script instead is way better, as the admin can easily change this setting if so inclined.

Didier Spaier 05-27-2017 05:11 AM

Previous content deleted: I mistakenly quoted my post #41 instead of editing it, sorry.


All times are GMT -5. The time now is 07:18 AM.