OS/2 REXX code identified as file type Batchfile #2142
Labels
No labels
accessibility
bug
bug
infrastructure
Codeberg
contributions welcome
docs
duplicate
enhancement
infrastructure
legal
licence / ToS
please chill
we are volunteers
public relations
question
question
user support
s/Forgejo
s/Forgejo/migration
s/Pages
s/Weblate
s/Woodpecker
security
service
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Codeberg/Community#2142
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Comment
The file type of an uploaded CMD source file is being identified as a "Batchfile", which is wrong in the case of REXX:
https://codeberg.org/xynix/MCD/src/branch/main/MCD.CMD
If the first 2 characters (starting at line 1, column 1) of a CMD file are "/*" (excluding the quotes), then it's not a more common CMD file. It's REXX (or Object REXX) source code.
https://www.os2.kr/komh/os2books/os2tk45/rexxpg/027_L2_Comments.html
As such typically not important for any targetted user at all, but at codeberg.org the perhaps more relevant programming language in use is REXX instead of some batch language.
IBM's definition is slightly different, but a more common CMD file won't start with the magic characters "/*".
No big deal for intended users, but people may be looking for REXX code xor Batchfiles.
It seems that the language detector always recognize
.cmd
as batchfiles. No mention of REXX.Its GetLanguageByModeline (https://github.com/go-enry/go-enry/tree/master) may be required.
To an user of a REXX app it will hardly matters, but specifically programmers may be looking for REXX code, by using some search filter.
In the case of the IBM operating systems OS/2, eComStation and ArcaOS, *.CMD is used for batchfiles and for REXX code. A comment starting at at line 1, column 1, triggers the executing by CMD.EXE or by REXX.DLL.
IBM, on the same subject, for yet another operating system:
https://www.ibm.com/docs/en/zos/2.4.0?topic=concepts-structure-general-syntax
If you store a REXX exec in a data set that is allocated to SYSPROC, the exec must start with a comment and the comment must contain the characters "“REXX”" within the first line (line 1) of the exec. This is known as the REXX exec identifier and is required in order for the TSO/E EXEC command to distinguish REXX execs from TSO/E CLISTs, which are also stored in SYSPROC.
The characters "“REXX”" must be in the first line (line 1) even if the comment spans multiple lines._
You may ignore the last line, about having to use the word REXX in the first line.
Actually the language can be Object REXX too, but I'd restrict it to REXX.
Other REXX interpreters may use own file extensions, so REXX isn't restrcited to *.CMD files.
For example, with Windows and Open Object REXX v3.2.x, I'm executing *.REX files as if such a file is a batchfile. Screenshot added.
Third-party (Object) REXX interpreters may use own file extensions. Like, but not limited to *.RX, *,REX, *.REXX and *.VRX.
With Unixes, there's a trick to mix both. A valid Batchfile, which is also a REXX app. IIRC. Same trick, with a comment.
The utility FILE isn't perfect too. A REXX *.CMD file is an ASCII text file, according to file.
If I restrict it to a programming relatred website and *.CMD files, a (case-insensitive) .CMD file starting with / should be considered to be REXX code.
Or Object REXX code, but both are a member of the REXX family.
As stated earlier, a Batchfiles-status nasicly is no insult (a *.CPP source file is a text file too), but in the case of *.CMD GetLanguageByModeline may have to be used too. It's a Batchfile, unless it starts with a comment. Then it's REXX.
I'd skip checking the full comment, with just /* as the 'shebang'. Starting at line 1, position 1.
You can execute my MCD.CMD with Windows. Then windows will send each line of that Batchfile to CMD.EXE, with many errors. So the other way arround, such a REXX *.CMD file isn't an "Batchfile".
Again: one can refer to a *.CPP source file as a text file, but calling it "C++" would be more perfect. Hence he suggestion to improve the detection, buit I'll accept the wrong label. To a targetted user it won't really matter, but programmers may care. But if you are using Windows and give my MCD.CMD "Batchfile" a try, then you may be disappointed. No big deal, and probably no danger at all.