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 770944 - I have no Metadata options in the batch rename dialog
I have no Metadata options in the batch rename dialog
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
3.21.x
Other Linux
: Normal normal
: 3.22
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-06 11:37 UTC by Yosef Or Boczko
Modified: 2017-02-03 09:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot (201.07 KB, image/png)
2016-09-06 11:37 UTC, Yosef Or Boczko
  Details
batch-rename-utilities: escape strings in the sparql query (2.65 KB, patch)
2017-01-02 14:44 UTC, Alexandru Pandelea
none Details | Review
batch-rename-utilities: escape strings in the sparql query (2.94 KB, patch)
2017-01-02 15:05 UTC, Alexandru Pandelea
committed Details | Review
batch-rename-utilities: check if file has nie:url (1.61 KB, patch)
2017-01-02 20:51 UTC, Alexandru Pandelea
committed Details | Review

Description Yosef Or Boczko 2016-09-06 11:37:29 UTC
Created attachment 334894 [details]
Screenshot

I donn't know why but I have no options for metadata in the rename
dialog.
I tried it with ogg and mp3 files.

Any idea?
Comment 1 Carlos Soriano 2016-09-06 13:31:03 UTC
Are they present in tracker?
Comment 2 Mohammed Sadiq 2016-11-15 12:58:29 UTC
I came accross this same bug today. The files are indexed by tracker.

I get the following warning when the batch rename dialog opens:
** (nautilus:13668): WARNING **: Error on batch rename tracker query cursor: Invalid arguments

Thanks
Comment 3 Mohammed Sadiq 2017-01-01 03:00:05 UTC
I can still reproduce this with nautilus git master using jhbuild
Comment 4 Alexandru Pandelea 2017-01-02 14:44:51 UTC
Created attachment 342722 [details] [review]
batch-rename-utilities: escape strings in the sparql query

The sparql query will fail if the file name or the parent uri have a
character that needs escaping. An example would be the character '

To fix this, escape the file name and the parent uri in the query.
Comment 5 Ernestas Kulik 2017-01-02 14:49:39 UTC
Review of attachment 342722 [details] [review]:

LGTM apart from one thing.

::: src/nautilus-batch-rename-utilities.c
@@ +1070,3 @@
         file = NAUTILUS_FILE (l->data);
         file_name = nautilus_file_get_name (file);
+        file_name_escaped = g_markup_escape_text (file_name, -1);

My understanding is that this is cleaned up after it goes out of scope (because g_autofree attribute). file_name_escaped is declared at the function scope, so it only is cleaned up when the function returns, resulting in leaks here.
Comment 6 Alexandru Pandelea 2017-01-02 15:01:34 UTC
(In reply to Mohammed Sadiq from comment #2)
> I came accross this same bug today. The files are indexed by tracker.
> 
> I get the following warning when the batch rename dialog opens:
> ** (nautilus:13668): WARNING **: Error on batch rename tracker query cursor:
> Invalid arguments
> 
> Thanks

I couldn't reproduce this error, but I think that what's most likely to cause the problem is something going wrong with an argument of tracker:uri-is-parent, so it could be a problem with one of the files' metadata. Can you give me the steps you followed to get this error or two files for which this occurs?

Thanks!
Comment 7 Alexandru Pandelea 2017-01-02 15:05:34 UTC
Created attachment 342723 [details] [review]
batch-rename-utilities: escape strings in the sparql query

The sparql query will fail if the file name or the parent uri have a
character that needs escaping. An example would be the character '

To fix this, escape the file name and the parent uri in the query.
Comment 8 Ernestas Kulik 2017-01-02 15:23:21 UTC
Review of attachment 342723 [details] [review]:

Sure, thanks!

::: src/nautilus-batch-rename-utilities.c
@@ +1036,3 @@
     g_autofree gchar *parent_uri = NULL;
+    g_autofree gchar *parent_uri_escaped = NULL;
+    gchar *file_name_escaped;

I can’t remember our declaration policy for the life of me - only at the function scope? Wherever?

Moving file_name_escaped to the loop and slapping on the g_autofree attribute would work fine.

Note to Carlos: we really need to document this someplace (maybe the HACKING file, since it needs some touching up anyway, probably).
Comment 9 Alexandru Pandelea 2017-01-02 20:51:17 UTC
Created attachment 342736 [details] [review]
batch-rename-utilities: check if file has nie:url

If there is a file indexed by tracker that doesn't have nie:url, then
the query will fail everytime, because it will pass null to
uri-is-parent which will then give an error.

To fix this, in the query, check first that the file has nie:url.
Comment 10 Carlos Soriano 2017-01-04 08:54:10 UTC
> Note to Carlos: we really need to document this someplace (maybe the HACKING
> file, since it needs some touching up anyway, probably).

Oh yes, still figuring it out. The https://etherpad.gnome.org/p/nautilus had some of these to ask contributors what is preferred (you missed that videocall).
Comment 11 Carlos Soriano 2017-01-04 08:55:05 UTC
>I can’t remember our declaration policy for the life of me - only at the function scope? Wherever?

At the start of any scope, since this is required for the autopointers.
Comment 12 Carlos Soriano 2017-01-04 08:58:20 UTC
Review of attachment 342736 [details] [review]:

really? If the file doesn't have url attribute, then we cannot even match with it and it will disappear from the query no?
Do you know when this happen?
Comment 13 Ernestas Kulik 2017-01-04 09:51:17 UTC
(In reply to Carlos Soriano from comment #12)
> Review of attachment 342736 [details] [review] [review]:
> 
> really? If the file doesn't have url attribute, then we cannot even match
> with it and it will disappear from the query no?
> Do you know when this happen?

The problem is that the files may have the attribute, but the warning is still emitted. Mohammed was working with Alex to get to the bottom of that.
Comment 14 Carlos Soriano 2017-01-04 09:59:30 UTC
Ah okay, let's wait for more info then :)
Comment 15 Ernestas Kulik 2017-01-04 12:09:53 UTC
Alex, sorry I missed you. The patch indeed makes the warning go away.
Comment 16 Alexandru Pandelea 2017-01-04 12:47:39 UTC
Np, thanks for testing it :)
Comment 17 Carlos Soriano 2017-02-02 17:49:29 UTC
Review of attachment 342736 [details] [review]:

Ok so the discussion is:

a more practical example, playlists in gnome-music: both the m3u files in your fs and the playlists you create through gnome-music will be a nmm:Playlist, but only the former will additionally be a nfo:FileDataObject with a nie:url"
he gave me this example
csoriano	alexp_: so the playlist you create in gnome-music are in tracker, but not in the fs right?
alexp_	csoriano: right
csoriano	alexp_: and those appear in the batch renaming?
and we try to get the url?
is this what I don't understand
alexp_	csoriano: they don't appear in the batch renaming, but the query also looks at those
csoriano	aha!
ok let me look then
alexp_: oh right makes sense
thanks for explaining

Therefore makes sense to me, thanks!
Comment 18 Alexandru Pandelea 2017-02-03 09:48:38 UTC
Attachment 342723 [details] pushed as 73ac9ee - batch-rename-utilities: escape strings in the sparql query
Attachment 342736 [details] pushed as 783d816 - batch-rename-utilities: check if file has nie:url