Special Characters and Pattern Matching

A forum for general AmigaOS 4.x support questions that are not platform-specific

Special Characters and Pattern Matching

Postby Amigo1 » Mon Dec 02, 2019 10:16 am

Hi all,

let's say I was particularly smart and executed the following command:

Code: Select all
copy clone s:user-startup "ram:User-Startup_`date "
:-)

how can I delete this incredible brain flower?

I tried with pattern
Code: Select all
 delete "ram:user#?"

or
Code: Select all
delete ram:user#?


I tried a single pattern matching char
Code: Select all
 delete "ram:user-startup_2019-12-02 08?58"

and using apostrophe to escape the column
Code: Select all
 delete "ram:user-startup_2019-12-02 08':58"

Code: Select all
 delete "ram:user-startup_2019-12-02 08'':58"


each time I got a system requester asking me to "Please insert volume user-startup_2019-12-02 08: in any drive."

The file does not even appear in a Workbench window, I can list the file in a shell, but the RAM: Window in Workbench is empty, except for T and clipboards. Also when I double-click on the RAM Disk Icon, workbench asks for the same Volume. Every now and then, I get a DSI too.

Is my only option to cold reboot the System? A warm reboot makes it hang at the AmigaOS 4.1 FE splash screen after I tried the above.. :?:
User avatar
Amigo1
 
Posts: 200
Joined: Sun Jan 01, 2012 4:32 pm

Re: Special Characters and Pattern Matching

Postby nbache » Mon Dec 02, 2019 11:48 am

DOpus4 can delete it - just tried it here.

Best regards,

Niels
User avatar
nbache
Beta Tester
Beta Tester
 
Posts: 1396
Joined: Mon Dec 20, 2010 8:25 pm
Location: Copenhagen, Denmark

Re: Special Characters and Pattern Matching

Postby Amigo1 » Mon Dec 02, 2019 5:16 pm

nbache wrote:DOpus4 can delete it - just tried it here.

Best regards,

Niels


As helpful as always! Thank you! :D

Do you think it is a bug or is it how it is supposed to work on the shell and workbench part but it's worth to ask for an enhancement?
User avatar
Amigo1
 
Posts: 200
Joined: Sun Jan 01, 2012 4:32 pm

Re: Special Characters and Pattern Matching

Postby thomasrapp » Mon Dec 02, 2019 5:38 pm

I would post a bug report. RAM-Handler should not accept colons in file names when creating new files.
User avatar
thomasrapp
 
Posts: 279
Joined: Sun Jun 19, 2011 12:22 am

Re: Special Characters and Pattern Matching

Postby colinw » Tue Dec 03, 2019 3:00 am

thomasrapp wrote:I would post a bug report. RAM-Handler should not accept colons in file names when creating new files.


No, you are completely allowed to shoot yourself in the foot anytime, "AmigaOS" is not "NannyOS".
Just because the shell has "special" uses for some characters, and the pattern matcher also does too,
and a couple have special meaning for DOS, ( namely colon and slash ), doesn't make them "illegal" in a name,
it just makes them incredibly inadvisable to use in a name, with an extra splashing of damn stupid,
if you want to access the name from a commandline or using pattern matching.
Hey, even putting a space in a name will make peoples head explode when trying to access it from a shell.

If the shell, DOS or filesystems started filtering "acceptable" names, i'd never hear the end of it.
Then there is the problem of who decides what is "acceptable".

You may want to create a directory called "b4ip:keep:out:of:here", that will do exactly what you want.
As it is now, the newer filesystems and DOS can also use UTF-8 encoding, i'm sure there will be some
interesting name combinations with that too.
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 180
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.

Re: Special Characters and Pattern Matching

Postby nbache » Tue Dec 03, 2019 11:36 am

It's a part of the total picture, though, that trying to do the same as the OP showed, on NGFS, SFS or FFS results in an error message. Not necessarily a useful and informative one, but at least one that prevents the file from being created.

On FFS and NGFS it says that the object couldn't be opened for writing because it doesn't exist, on SFS (1.290) it says that the object name is invalid.

Edit: This is with the Danish country settings, in which the date format contains a slash (/). If I repeat the test, using the generated name explicitly, except with the slash replaced by a dash, both FFS and SFS say that the object name is invalid, whereas NGFS actually allows me to create the file.

E.g.:

Code: Select all
copy clone s:user-startup "NGTest:User-Startup_Tirsdag 03-12-2019 10:24:58"


Best regards,

Niels
User avatar
nbache
Beta Tester
Beta Tester
 
Posts: 1396
Joined: Mon Dec 20, 2010 8:25 pm
Location: Copenhagen, Denmark

Re: Special Characters and Pattern Matching

Postby MichaelMerkel » Tue Dec 03, 2019 1:47 pm

isn't there an escape character which can be used in this case with the dos commands?
like the backslash in linux?
i mean, that's what an escape character good for...

regards...
michael
Michael Merkel :lol:
(Member of Amiga Freunde Pfalz)
User avatar
MichaelMerkel
Beta Tester
Beta Tester
 
Posts: 342
Joined: Mon Dec 20, 2010 3:08 pm
Location: Germany

Re: Special Characters and Pattern Matching

Postby thomasrapp » Tue Dec 03, 2019 6:32 pm

The escape character can be used to escape wildcard characters from pattern matching.

In this thread the issue is different. The file name containing a colon does not take part in pattern matching, it is presented to the handler and the handler can decide whether it is a valid file name or not.

In case of impossible file names the handler should refuse them.

BTW, this works correctly in OS3. It is a bug which was introduced in OS4. So it should be fixed.
User avatar
thomasrapp
 
Posts: 279
Joined: Sun Jun 19, 2011 12:22 am

Re: Special Characters and Pattern Matching

Postby Minuous » Wed Dec 04, 2019 7:10 am

colinw wrote:Just because the shell has "special" uses for some characters, and the pattern matcher also does too,
and a couple have special meaning for DOS, ( namely colon and slash ), doesn't make them "illegal" in a name


Colon and slash are illegal in filenames; this is stated in the official AmigaDOS Manual (section 1.1).
Minuous
 
Posts: 10
Joined: Mon Dec 21, 2015 11:36 am

Re: Special Characters and Pattern Matching

Postby colinw » Wed Dec 04, 2019 11:24 pm

Minuous wrote:
colinw wrote:Just because the shell has "special" uses for some characters, and the pattern matcher
also does too, and a couple have special meaning for DOS, ( namely colon and slash ), doesn't make them "illegal" in a name


Colon and slash are illegal in filenames; this is stated in the official AmigaDOS Manual (section 1.1).


I'm sure it probably says that, I don't have a copy on hand, but...
Here is the situation, whether a particular character is going to cause trouble is completely dependant upon
the interface or subsystem you are going to access it through, for example;

It would be extremely unwise to use characters reserved for pattern matching control if you were accessing it
through something that uses the pattern matching functions, like the C: commands for instance.
It would be extremely unwise to use characters reserved for shell control like spaces and >< etc...
if you intended to access it through a commandline, as these are used as word delimiters and stream control.

As far as DOS is concerned, it uses only two characters, colon and slash to parse a DOS path out of a string,
(and it only uses the first colon it finds by the way), so if you were to pass something that had those,
through a DOS function like Open() or Lock(), which is required to split up the path components,
to find which file handler and directory should be used, then all kinds of problems will likely visit you.

Ultimately, the filesystem is responsible to decide what characters are allowed, but the problem is that unless
those characters are in the low 7 bit ascii range, (<0x7F) the filesystem cannot decide because it is completely
unaware of the current charset map or locale settings or even if you are passing it a UTF-8 encoded name.
It just stores what you give it. If it even tried to get too-smart, it would undoubtedly break something.

However, after saying that, and that it should be obvious that a user shouldn't do it, it probably would be
acceptable for a filesystem to limit creating names with a ":" or "/" just incase.
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 180
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.

Next

Return to General AmigaOS

Who is online

Users browsing this forum: No registered users and 2 guests