Opened 10 years ago
Closed 10 years ago
#5246 closed Bug (fixed)
Problems when incomplete-dir is a subdirectory of download-dir
Reported by: | alindt | Owned by: | jordan |
---|---|---|---|
Priority: | Normal | Milestone: | 2.80 |
Component: | GTK+ Client | Version: | 2.76 |
Severity: | Normal | Keywords: | backport-2.7x incomplete subdirectory download transmission-gtk gtk+ |
Cc: |
Description
When incomplete-dir is enabled and it happens to be a subdirectory of download-dir, after restarting the GTK+ client download-dir (silently) becomes the same as incomplete-dir.
This doesn't happen in transmission-qt.
Steps to reproduce:
0. (optional) backup & delete ~/.config/transmission/settings.json
1. launch transmission-gtk (transmission-qt is unaffected)
2. (optional) close transmission-gtk without changing any of the preferences
$ grep -- "-dir" ~/.config/transmission/settings.json "download-dir": "/home/alin/Downloads", "incomplete-dir": "/home/alin/Downloads", "incomplete-dir-enabled": false, "open-dialog-dir": "/home/alin", "watch-dir": "/home/alin/Downloads", "watch-dir-enabled": false
3. launch transmission-gtk
4. enable "Keep incomplete files in" and select a subdirectory in "Save to location" directory (I chose ~/Downloads/incomplete)
5. close transmission-gtk
6. *sigh*
$ grep -- "-dir" ~/.config/transmission/settings.json "download-dir": "/home/alin/Downloads/incomplete", "incomplete-dir": "/home/alin/Downloads/incomplete", "incomplete-dir-enabled": true, "open-dialog-dir": "/home/alin", "watch-dir": "/home/alin/Downloads/incomplete", "watch-dir-enabled": false
Actually, it seems that every directory but open-dialog-dir is changed to the value of incomplete-dir.
Attachments (1)
Change History (18)
comment:1 Changed 10 years ago by taem
comment:2 Changed 10 years ago by jordan
- Component changed from GTK+ Client to libtransmission
- Status changed from new to assigned
comment:3 Changed 10 years ago by jordan
I can't reproduce this in either 2.76 or in trunk. When I reach step 6 in 2.76, I get
"download-dir": "/home/jordan/Downloads", "incomplete-dir": "/home/jordan/Downloads/incomplete", "incomplete-dir-enabled": true, "open-dialog-dir": "/home/jordan", "watch-dir": "/home/jordan/Downloads", "watch-dir-enabled": false
and from trunk, I get
"download-dir": "/home/jordan/Downloads", "incomplete-dir": "/home/jordan/Downloads/incomplete", "incomplete-dir-enabled": true, "open-dialog-dir": "/home/jordan", "watch-dir": "/home/jordan/Downloads", "watch-dir-enabled": false
alindt, I'm trying to think of what might be different in your setup that could cause this. Does the ~/Downloads/incomplete directory you've selected actually exist? Does the problem persist if you run Transmission with LANG=C, or as a guest user on your machine?
comment:4 Changed 10 years ago by jordan
- Status changed from assigned to new
comment:5 Changed 10 years ago by alindt
The problem persists even when running with LANG=C or as a different user.
I've narrowed the behaviour down to GtkFileChooser? with the Location button pressed (http://developer.gnome.org/gtk3/3.6/GtkFileChooser.html#GtkFileChooserDefault-location-popup)
When Location is not pressed everything works as intended, but as soon as I press it and then navigate to the desired incomplete-dir it seems that it autocompletes the selected directory down to the deepest subdirectory in the tree (especially if Downloads/incomplete/ contains other subdirs) right after clicking "Open" and that ends up being the value returned to the caller.
Maybe this is a libgtk problem after all?
comment:6 Changed 10 years ago by jordan
alindt, possibly.. Transmission doesn't touch that dialog at all; it only creates a gtk_file_chooser_button_new() and listens for its signal. You might want to submit this upstream to bugs.gnome.org.
comment:7 Changed 10 years ago by alindt
it's still weird though: why would all the *-dir values change throughout transmission since the only interaction is with the file chooser button for incomplete-dir?
just curious - can you confirm the "when Location button is pressed in GtkFileChooserDialog?" part?
$ ldd `which transmission-gtk` | grep "gtk" libgtk-3.so.0 => /usr/lib/i386-linux-gnu/libgtk-3.so.0 (0xb7205000) libdbusmenu-gtk3.so.4 => /usr/lib/i386-linux-gnu/libdbusmenu-gtk3.so.4 (0xb69f3000) $ dpkg -l | egrep -i "(libgtk-3|libdbusmenu-gtk3)" | awk '{print $3 "\t" $2}' 12.10.2-0ubuntu1 libdbusmenu-gtk3-4:i386 3.6.0-0ubuntu3.2 libgtk-3-0:i386 3.6.0-0ubuntu3.2 libgtk-3-bin 3.6.0-0ubuntu3.2 libgtk-3-common
comment:8 Changed 10 years ago by jordan
alindt, since we're talking about behavior that seems to be triggered by the way you're inputting data into the dialog, could you revise step 4 from your original list s.t. I can try your exact steps to reproduce the issue here?
comment:9 Changed 10 years ago by kraai
I don't know if I'm experiencing the same problem or not. In my case, if the download, incomplete, or watch directory contains a subdirectory and I open and close the preferences window, the setting is changed to point to the subdirectory. For example, if the download directory is ~/Downloads, ~/Downloads/subdirectory exists, and I open and close the preferences window, when I look at ~/.config/transmission/settings.json, download-dir will be set to ~/Downloads/subdirectory.
This appears to be caused by the call to gtk_file_chooser_set_current_folder in new_path_chooser_button in gtk/tr-prefs.c. This function sets the working directory for the file chooser. If that directory contains a directory, it appears to also set the selection to that directory. If I change this call to gtk_file_chooser_set_filename, the problem goes away.
comment:10 Changed 10 years ago by jordan
- Component changed from libtransmission to GTK+ Client
comment:11 Changed 10 years ago by jordan
comment:12 Changed 10 years ago by alindt
jordan, r13955 seems to fix it
comment:13 Changed 10 years ago by jordan
- Milestone changed from None Set to 2.77
- Status changed from new to assigned
Great! Thanks for the quick response. :)
comment:14 Changed 10 years ago by jordan
- Resolution set to fixed
- Status changed from assigned to closed
Changed 10 years ago by foser
comment:15 Changed 10 years ago by foser
- Resolution fixed deleted
- Status changed from closed to reopened
The current fix has a rather major problem.
Apparently just calling gtk_filechooser_set_filename already triggers a selection-changed callback to chosen_cb in tr-prefs.c , without the filechooser being properly set up. This results in garbage being written to "download-dir" and "incomplete-dir" every time a new preferences window is opened, setting the actual download loctions to 'none'.
In some cases in my experience it corrupted the settings.json file with non-UTF-8 symbols in a way that I had to redo all my preferences.
Added patch only enables the cb after the filechooser widget has been created and fixes the issue.
comment:17 Changed 10 years ago by jordan
- Keywords backport-2.7x added
- Resolution set to fixed
- Status changed from reopened to closed
...actually, looks like this is already fixed in 2.80 by an unrelated commit. :/
Closing as fixed and marking for backport-2.7x in case there's ever another 2.7x release.
I cannot reproduce this ticket with the latest trunk.