After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 601476 - How about match XDG standards and get rid of ~/.nautilus
How about match XDG standards and get rid of ~/.nautilus
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
2.30.x
Other Linux
: Normal normal
: 3.0
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 518587 613297 (view as bug list)
Depends on:
Blocks: 523057
 
 
Reported: 2009-11-11 03:59 UTC by Jason
Modified: 2010-10-07 16:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nautilus xdg patch (1.89 KB, text/plain)
2009-11-11 03:59 UTC, Jason
  Details
nautilus-xdg.patch (766 bytes, patch)
2010-03-04 18:34 UTC, Jason
none Details | Review
Don't use ~/.nautilus anymore (#601476). (1.13 KB, patch)
2010-04-13 16:11 UTC, Cosimo Cecchi
committed Details | Review
Migrate confguration to XDG_CONFIG. (1.83 KB, patch)
2010-04-13 16:11 UTC, Cosimo Cecchi
none Details | Review
Migrate confguration to XDG_CONFIG. (1.95 KB, patch)
2010-04-14 00:40 UTC, Cosimo Cecchi
none Details | Review
Migrate confguration to XDG_CONFIG. (2.03 KB, patch)
2010-04-14 12:31 UTC, Cosimo Cecchi
committed Details | Review

Description Jason 2009-11-11 03:59:01 UTC
Created attachment 147443 [details]
nautilus xdg patch

and nautilus is no longer depends on gnome, change config dir to
$XDG_CONFIG_HOME will be better.

See http://www.freedesktop.org/wiki/Specifications/basedir-spec
See also
- http://ploum.frimouvy.org/?184-cleaning-user-preferences-keeping-user-data
(main post and comment#8)
- http://www.aigarius.com/blog/2007/01/10/fhs-extension-for-user-home-folders/
Comment 1 Jason 2009-11-11 04:11:32 UTC
or use ~/.gnome2/nautilus instead of ~/.nautilus is still ok if naulitus must be a "part" of gnome.
Comment 2 A. Walton 2009-11-11 09:17:13 UTC
Patch is wrong. We really don't use ~/.nautilus anymore, since the metadata was moved to GVFS (which properly uses the spec); however, we still need to migrate data in the case that the user has older preferences in ~/.nautilus, so that's what the code you're seeing actually does (which your patch breaks).

Closing as NOTABUG.
Comment 3 Jason 2009-11-11 09:32:53 UTC
sorry, i just want to get rid of ~/.nautilus

i am using nautilus 2.28, and naulitus will creat ~/.nautilus automaticly. 

isn't it no necessary to creat this dir as you said?
Comment 4 Jason 2010-03-04 18:34:46 UTC
Created attachment 155253 [details] [review]
nautilus-xdg.patch

Please see this bug again.

the problem is ibnautilus-private/nautilus-file-utilities.c will creat ~/.nautilus even now this dir is no use.

if nautilus need NAUTILUS_USER_DIRECTORY_NAME, define it to ~/.config/nautilus

here is the patch.
Comment 5 Jason 2010-03-12 15:04:25 UTC
Do i need open a new bug?
Comment 6 Christian Persch 2010-03-19 13:14:39 UTC
*** Bug 613297 has been marked as a duplicate of this bug. ***
Comment 7 Cosimo Cecchi 2010-04-13 16:11:46 UTC
Created attachment 158619 [details] [review]
Don't use ~/.nautilus anymore (#601476).

But use XDG_CONFIG to save configuration files.
Patch by jarryson.
Comment 8 Cosimo Cecchi 2010-04-13 16:11:49 UTC
Created attachment 158620 [details] [review]
Migrate confguration to XDG_CONFIG.
Comment 9 Cosimo Cecchi 2010-04-13 16:13:29 UTC
I improved the patch by adding some migration code to the new directory.
Comments welcome, I'd like to merge this after we branch gnome-2-30.
Comment 10 Alexander Larsson 2010-04-13 20:34:19 UTC
Does that migration patch work at all?
nautilus_application_startup() first calls check_required_directories() which should create the new xdg-based user dir. Then later the migration tries to move onto this xdg dir and will always fail.

Also:
+			if (errno == EEXIST || errno == ENOTEMPTY) {
+				g_remove (nautilus_dir);
+			} else {

This will always fail because the directory is not empty (g_remove is not recursive).

Additionally, i don't think we should remove the old data on migration failure. That could be a data loss. Maybe the user is using old versions of nautilus in parallel on the same homedir or something. Instead just put some file named THIS-DIRECTORY-IS-DEPRECATED in there with some comment about what version deprecated it and where it moved. Then anal-retentive cleanup people can remove it, and normal people will just never get it for new installs.
Comment 11 Cosimo Cecchi 2010-04-14 00:39:19 UTC
(In reply to comment #10)
> Does that migration patch work at all?
> nautilus_application_startup() first calls check_required_directories() which
> should create the new xdg-based user dir. Then later the migration tries to
> move onto this xdg dir and will always fail.

Yes, it works, because rename(), at least on Linux, works also with empty directory targets (manpage says "oldpath can specify a directory.  In this case, newpath must either not exist, or it must specify an empty directory.")

> +            if (errno == EEXIST || errno == ENOTEMPTY) {
> +                g_remove (nautilus_dir);
> +            } else {
> 
> This will always fail because the directory is not empty (g_remove is not
> recursive).

True; I removed that part and implemented the simple file approach you suggested.
Comment 12 Cosimo Cecchi 2010-04-14 00:40:41 UTC
Created attachment 158663 [details] [review]
Migrate confguration to XDG_CONFIG.
Comment 13 Alexander Larsson 2010-04-14 07:07:56 UTC
+		message = _("Nautilus 2.32 deprecated this directory and tried migrating "
+			    "this configuration in ~/.config/nautilus");

tried migrating this configuration *to* ...

Also, i would add a comment to the rename about rename over empty dir succeeding. Otherwise it looks good to me.
Comment 14 Cosimo Cecchi 2010-04-14 12:31:23 UTC
Created attachment 158709 [details] [review]
Migrate confguration to XDG_CONFIG.

Fixed last comments.
Comment 15 Cosimo Cecchi 2010-04-26 12:39:25 UTC
Comment on attachment 158619 [details] [review]
Don't use ~/.nautilus anymore (#601476).

Committed to master.
Comment 16 Cosimo Cecchi 2010-04-26 12:39:32 UTC
Comment on attachment 158709 [details] [review]
Migrate confguration to XDG_CONFIG.

Committed to master.
Comment 17 Cosimo Cecchi 2010-04-26 12:39:50 UTC
This is fixed now.
Comment 18 Cosimo Cecchi 2010-05-06 10:57:04 UTC
*** Bug 518587 has been marked as a duplicate of this bug. ***
Comment 19 Jason 2010-09-30 13:09:37 UTC
this bug happened again, why cancle these patches in nautilus 2.32?
Comment 20 Cosimo Cecchi 2010-09-30 13:19:51 UTC
(In reply to comment #19)
> this bug happened again, why cancle these patches in nautilus 2.32?

Please don't reopen bugs closed as FIXED by a maintainer.
This is indeed fixed in git master and in 2.90.1, so there's no reason for this bug to stay open.

I decided to drop this patch for the GNOME 2.32 release as I think 3.0 is a better release to remove legacy behavior such as this one.
Comment 21 Sebastian 2010-09-30 14:51:31 UTC
Dear Cosimo,

I can confirm that the ~/.nautilus folder is still created in the latest gnome release (tag 2.32.0), even though no data is written to it:

drwxr-xr-x  2 4.0K 2010-09-04 07:05 .nautilus

After `rm -rf ~/.nautilus` and starting nautilus I can see that the folder is still created on startup (as the recent timestamp shows:

drwxr-xr-x  2 4.0K 2010-09-30 16:38 .nautilus

I just had a look at the nautilus source (grep -Rn -A2 g_get_home *) and found that there are still quite a few accesses to the home folder. Here is a selection that might be worth a look at:

src/nautilus-application.c:596:	metafile_dir = g_build_filename (g_get_home_dir (),
src/nautilus-application.c-597-					 ".nautilus/metafiles", NULL);
--
src/nautilus-application.c:611:	nautilus_dir = g_build_filename (g_get_home_dir (),
src/nautilus-application.c-612-					 ".nautilus", NULL);

Cheers Sebastian
Comment 22 Sebastian 2010-09-30 14:59:27 UTC
well never mind, I just saw your message above, currious that in the notification email I got, only the bug change was mentioned but the message was not shown.
Comment 23 Javier Jardón (IRC: jjardon) 2010-10-07 16:04:57 UTC
New bug filled here: bug #631596