Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 119 - Linux: Export Multiple: "*" and "?" in label or track name wrongly rejected
Linux: Export Multiple: "*" and "?" in label or track name wrongly rejected
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: User Interface
2.1.3
Other Linux
: P3 Repeatable
Assigned To: Default Assignee for New Bugs
http://forum.audacityteam.org/viewtop...
: Cherry, patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-21 14:00 UTC by Gale Andrews
Modified: 2021-02-06 11:38 UTC (History)
6 users (show)

See Also:
Steps To Reproduce:
1 New project, new audio track, add some labels "a", "b", "c" and so on but include a slash in one of the labels. 2 File > Export Multiple. Export will come to a halt when it reaches the label with "/", complaining that it cannot export audio. 3 Remove the slash from the label and add * to one label and ? to another. These characters will bring up the illegal file names dialogue when they should be accepted.
Release Note:
GROUP:Imports and Exports * (Linux) '''When using Export Multiple, asterisks (*) or question marks (?) in track names or labels are wrongly rejected as illegal characters.''' As a '''Workaround''' you can force use of * or ? by exporting each region with File > Export Selected Audio... instead.
First Git SHA:
Group: LabelTrack
Workaround:
Closed: 2021-02-06 00:00:00
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Mac+
james.k.crook: Test‑OK‑Lin+


Attachments
patch from Seshadri Mahalingam to handle export multiple chars correctly (1.88 KB, patch)
2011-07-05 16:16 UTC, Gale Andrews
Details | Diff
Patch for bug 119 (1.88 KB, patch)
2011-07-08 01:52 UTC, Seshadri Mahalingam
Details | Diff
Updated patch (3.87 KB, patch)
2011-07-08 17:13 UTC, Seshadri Mahalingam
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gale Andrews 2010-02-21 14:00:48 UTC
On Linux, "/" is the file separator and illegal. It should be trapped and display our "not a legal filename" dialogue. Instead, it gives a confusing "cannot export audio to" message. 

On Mac, "/" is also the file separator but is translated internally by the OS so should be accepted. It succeeds when used in Audacity's Save/Export dialogues, but gives the same "cannot export audio to" error in Export Multiple.   

On both OS'es, "*" and "?" are trapped by the "not a legal filename" dialogue when they are perfectly legal.
Comment 1 Gale Andrews 2011-04-30 19:44:48 UTC
Promoting to P3 so that it can have a release note. It's quite often complained about.
Comment 2 Gale Andrews 2011-07-05 16:16:33 UTC
Created attachment 182 [details]
patch from Seshadri Mahalingam to handle export multiple chars correctly
Comment 3 Gale Andrews 2011-07-06 17:47:50 UTC
(In reply to comment #2)
Seshadri, I did look at/try the patch on Ubuntu - though I changed 
#if defined (__LINUX__) to #if defined (__WXGTK__). I am not on Mac. 

The only Linux change is to trap "/" as illegal so display the illegal filenames dialogue instead of the spurious error about "cannot write". That works in my test but I don't think it's a perfect fix because the dialogue checks wxFileName::GetForbiddenChars for its list of forbidden characters. So the dialogue still states that you cannot use any of *? - it should say you cannot use any of /*?. I don't know though exactly where the list is or understand why "/" is not on the list in the first place. 

Similarly the patch does not address the part of the bug that "*" and "?" are trapped on Mac and Linux by the dialogue. They should not be on the forbidden characters list for Mac or Linux. 

What happens on Mac after your patch if you type "/" in a label? It looks as if that would trigger the error dialogue, but if I understand it, "/"  is permitted when typing the file name in normal export because of the translation to ":".
Comment 4 Seshadri Mahalingam 2011-07-08 01:52:38 UTC
Created attachment 184 [details]
Patch for bug 119

Thanks for trying this out, Gale!

This patch and the previous one bypass the "*" and "?" restriction for both OS X and Linux. The dialog after applying the previous patch incorrectly stated that * and ? were not allowed on either operating system. The 'Export Multiple' sequence used wxFileName::GetForbiddenChars (http://docs.wxwidgets.org/stable/wx_wxfilename.html#wxfilenamegetforbiddenchars) which excludes "*" and "?" on all UNIXy operating systems.

The non-trivial part of the previous patch that I ought to have documented better handles "/" on Macs by replacing every occurrence of "/" with ":". The colon is the Classic path separating character and `touch f:b` for example will create a file denoted by Finder (the file explorer) as "f/b". To the UNIX layer however, the "/" character is seen as a ":". OS X does not permit ":" in a file name (probably due to historic reasons).

The new patch attains the desired functionality and makes the dialog more accurate by abstracting the forbidden character detection into an Audacity function. On a Mac, any label that doesn't contain a ":" character is permitted. On Ubuntu/Linux (untested!) only labels with a "/" should throw the dialog. "*" and "?" should now be permitted characters on both operating systems.
Comment 5 Gale Andrews 2011-07-08 12:38:32 UTC
(In reply to comment #4)
Thanks, Seshadri for the comments. I'll be glad to try your new patch on Ubuntu, but the patch you posted today is actually the same as the one I originally posted for you. 

With your patch (if I now understand it) if user on Mac enters "/", Audacity will accept it - the translation to ":" and back to "/" (as it appears in Finder) will all be done "under the hood"? 

I still don't quite understand why the Widgets list forbids "?" and "*" on Mac and Linux and forbids "/" on Mac. Is that a bug that should be corrected upstream or is there a reason it's the way it is?     

Meantime I changed bug status back to "REOPENED" - our current workflow is only to move to DEVEL - FIX MADE when a patch has been committed. I made this clearer now on http://wiki.audacityteam.org/wiki/Bug_Lists#Workflow_when_resolving_bugs .

Since I'm not actually a programmer, a developer will still need to review the patch for being "code appropriate" and take the decision to commit it.
Comment 6 Seshadri Mahalingam 2011-07-08 17:13:53 UTC
Created attachment 185 [details]
Updated patch

Whoops, sorry about the double-patch :S
The attached patch is the amended one that I referred to in my previous comment.

> the translation to ":" and back to "/" (as it appears in
> Finder) will all be done "under the hood"

Yes, that's right. However, with this patch, when the user sees the success dialog that lists file paths, they may see the 

The wx source for GetForbiddenChars is available at:
http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/common/filename.cpp#L1760

The wxPATH_MAC case is misleading and applies only to Classic, pre-OS X Macs. On OS X the wxPATH_UNIX flag is on, so wx defaults to claiming * and ? are invalid. This is incorrect under the UNIX, Linux and OS X platforms, and I think should probably be corrected upstream.

In the meantime, this patch should correct Audacity's behaviour.
Comment 7 Gale Andrews 2011-07-19 20:27:58 UTC
(In reply to comment #6)
Thanks, Seshadri. It seems to work fine on Ubuntu 10.10 now.

One small point is that I believe the illegal filenames dialogue on Mac now says "You cannot use any of: :". On Linux it says "You cannot use any of: /". However on Ubuntu the bottom of that "/" character makes it seem there is no space between ":" and "/" so it looks like "cannot use any of:/". I think it could still confuse on Mac even if the space between the two colons is evident. I'd propose changing this to "You cannot use %s characters.\nUse...". If we apply the patch and don't want to break translations for 2.0 I suggest this could be marked as a TODO.  

>> the translation to ":" and back to "/" (as it appears in Finder) will all 
>> be done "under the hood"
> Yes, that's right. However, with this patch, when the user sees the success
> dialog that lists file paths, they may see the 
Can you complete that sentence?

> The wxPATH_MAC case is misleading and applies only to Classic, pre-OS X Macs.
> On OS X the wxPATH_UNIX flag is on, so wx defaults to claiming * and ? are
> invalid. This is incorrect under the UNIX, Linux and OS X platforms, and I
> think should probably be corrected upstream.
+1.
Comment 8 Vaughan Johnson 2012-02-01 20:41:54 UTC
(In reply to comment #3)

> The only Linux change is to trap "/" as illegal so display the illegal
> filenames dialogue instead of the spurious error about "cannot write". That
> works in my test but I don't think it's a perfect fix because the dialogue
> checks wxFileName::GetForbiddenChars for its list of forbidden characters. 

Right. I've reviewed the patch, and I think it's better to get the result from wxFileName::GetForbiddenChars() (which catches several the patch does not). The right approach is to let wxWidgets changes help us, and modify the string if necessary. 

In fact, I see this was reported 2010-02-21, and the patch in July 2011. I believe our upgrade to wxWidgets 2.8.12 fixed at least part of this. wxFileName::GetForbiddenChars() in 2.8.12:

* Returns wxT("*?") for all platforms except wxPATH_MAC and wxPATH_DOS. 

* Returns wxT("") for Mac, and has an explicit comment that * and ? are allowed.

* Returns wxT("*?\\/:\"<>|" for wxPATH_DOS.


So is the only change we currently need, to add to the result for wxPATH_UNIX, so it's wxT("*?/")?  

Or that plus make the Mac forbiddens be wxT(":")?
Comment 9 Paul L 2016-06-20 22:33:22 UTC
Please evaluate this fix:

02ce3c312bb63874565dcfc311f842341a8f539a
Comment 10 Gale Andrews 2016-06-21 00:06:19 UTC
(In reply to Paul L from comment #9)
Hi Paul

Thanks for all the fixes. Pasting links to fixes - not just a revision # - would be greatly appreciated.
Comment 11 Paul L 2016-06-21 00:27:32 UTC
I thought my old habit of giving links to GitHub was more care than was expected, that a commit id was enough.  But if you think otherwise, very well then:

https://github.com/audacity/audacity/commit/02ce3c312bb63874565dcfc311f842341a8f539a
Comment 12 Peter Sampson 2016-06-21 10:01:26 UTC
(In reply to Paul L from comment #11)
Tests ok on Mac El Capitan d6187f6 21Jun16
Comment 13 Peter Sampson 2016-06-21 10:48:16 UTC
Behavior is different on Windows - here the "/", "*" or "?" gets replaced with an underscore "_" in the filename.

Or the user is offered the chance to alter it to a legally valid filename Manually .

Note that the "/", "*" or "?" are retained for the metadata "Title" - this is correct behavior I believe.
Comment 14 Paul L 2016-06-21 10:51:12 UTC
Are you saying any part of the Windows behavior is incorrect?  I believe none of it is wrong.
Comment 15 Peter Sampson 2016-06-21 10:55:37 UTC
(In reply to Paul L from comment #14)
>Are you saying any part of the Windows behavior is incorrect?

No, just clumsily worded - I too think the Windows behavior is correct
Comment 16 Gale Andrews 2016-07-10 11:55:14 UTC
Thanks Paul.

Yes I think Windows behavior in choosing what characters are valid or not remains correct. 

Seems OK on Mac but the problem is not corrected on Linux. We still reject * and ? in Export Multiple as at "c9422aa" 08Jul16, so REOPENED. The only character we want to reject on Linux is the forward slash.

I want to request a tweak to the Save As... error dialogue when an illegal character is encountered. At present we have the string "You cannot use any of:" but the colon in that string is confusing when colon is valid, as it is on Linux, and on Mac, where colon is the only rejection. 

I suggest "You cannot use any of these".
Comment 17 Gale Andrews 2016-07-10 13:37:51 UTC
Also on Linux the Save As... dialogue sometimes shows repeats of the invalid characters e.g. 

  cannot use any of:*?/*?/*?/*?/ 

I got it frequently after experimenting with cases where tracks and labels contain characters that Audacity rejects. I saved a project for such a case, which save of course crashed due to bug 1397. When I recovered the project, and tried Export Multiple, the Save As... dialogue only showed one set of invalid characters. 

Something to bear in mind when this is fixed for Linux.
Comment 18 Gale Andrews 2016-09-07 18:48:37 UTC
(In reply to Gale Andrews from comment #16)
> I want to request a tweak to the Save As... error dialogue when an illegal
> character is encountered. At present we have the string "You cannot use 
> any of:" but the colon in that string is confusing when colon is valid, as
> it is on Linux, and on Mac, where colon is the only rejection.
James has fixed this at https://github.com/audacity/audacity/commit/b56ea05 . That fix should work on Linux when this bug is fixed on Linux.
Comment 19 Gale Andrews 2016-09-10 10:38:28 UTC
(In reply to Gale Andrews from comment #17)
> Also on Linux the Save As... dialogue sometimes shows repeats of the invalid 
> characters e.g. 
>
> cannot use any of:*?/*?/*?/*?/ 
> 
> I got it frequently after experimenting with cases where tracks and labels 
> contain characters that Audacity rejects

I have now seen it twice on Windows too.
Comment 20 Gale Andrews 2017-02-02 18:50:12 UTC
Updated "Hardware", bug title and Release Note to be Linux only.
Comment 21 Leland Lucius 2021-01-30 10:18:24 UTC
Fix to bug as originally stated:

https://github.com/audacity/audacity/commit/7548388

And I reworded the message dialog a bit to make the invalid character to stand out better.

However, I was unable to reproduce Gale's mentioned in comments 17 and 19.
Comment 22 James Crook 2021-02-06 11:38:34 UTC
Tested on linux too.  Works fine.  Suggests changing "/" to "_" and does so.

RESOLVED FIXED