'tracker' is a command-line file indexing and searching tool. Among other things, it allows files to be annotated with tags. I'm trying to delete a tag from a PDF file. Other tags on other files have deleted successfully. This tag name is long and has some special characters in it:
$ tracker tag -ts
Tags (shown by name):
setup# connections# features# upgrading# troubleshooting# recovery# specifications
#esuprt_desktop#esuprt_alienware_dsk#Alienware Aurora#alienware-aurora#Owner's Manual
file://FILEPATH.pdf
Note the newline in the tag name after "specifications".
(I've substituted FILEPATH in here instead of the actual file name. It doesn't seem to be relevant. I've successfully deleted other tags in similar paths before, and have moved this file just in case, but am still unable to delete its tag)
I'm failing to delete this tag, using tracker tag -d TAGNAME
, presumably due to my failure to represent or escape the special characters in the tag name. I first tried things like:
$ tracker tag -d "setup# connections# features# upgrading# troubleshooting# recovery# specifications
#esuprt_desktop#esuprt_alienware_dsk#Alienware Aurora#alienware-aurora#Owner's Manual"
This reports "Tag was removed successfully", but that's a lie - the tag is still present. This is the message that is displayed when deleting a tag that doesn't exist:
$ tracker tag -d NONEXISTANT
Tag was removed successfully
To make the special characters in the tag name visible, I used:
$ tracker info 'file://FILEPATH.pdf' | grep hasTag
'nao:hasTag' = 'urn:tag:setup%23%20connections%23%20features%23%20upgrading%23%20troubleshooting%23%20recovery%23%20specifications%0D%0A%23esuprt_desktop%23esuprt_alienware_dsk%23Alienware%20Aurora%23alienware-aurora%23Owner's%20Manual'
Here we can see the urlencoded special characters. What I described as a "newline" earlier is actually a %0D%0A, which I think I can pass on the command-line using "\r\n" (Update: this is my mistake, see @steeldriver's answer), hence, maybe my delete should read:
$ tracker tag -d "setup# connections# features# upgrading# troubleshooting# recovery# specifications\r\n#esuprt_desktop#esuprt_alienware_dsk#Alienware Aurora#alienware-aurora#Owner's Manual"
Tag was removed successfully
This message, again, is a lie. The tag is still present.
I'm in Bash, on Ubuntu 20.10 Groovy. I do have ownership and write permissions to the tagged file, although don't think that is required.