Skip to content

Improve wildcard handling for imgmount file arguments #2270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Feb 9, 2023

Previously, alpha-numeric sorting was used when mounting disk images with wildcards.

This works fine when disk image numbers are zero-padded up to the largest, for example in an 11 disk set: disk01.img, disk02.img, ..., disk11.img.

However, sometimes disks aren't zero-padded resulting in unwanted ordering:

2023-02-08_17-49

This PR adds natural sorting:

2023-02-08_17-51_1

And nicer logging of the result.

  • Singles: 2023-02-08_17-50_1

  • Pairs: 2023-02-08_17-50_2

  • Three or more: 2023-02-08_17-51

It also adds filename to the console log messages, which can help when reporting issues or when parsing with a script:

2023-02-08 | FAT: Mounted disk1.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk2.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk3.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk4.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk5.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk6.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk7.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk8.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk9.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk10.img as FAT12 volume with 2847 clusters
2023-02-08 | FAT: Mounted disk11.img as FAT12 volume with 2847 clusters

Thanks to @Eulisker from the eXoDOS project for catching this bug 👍 !

@kcgen kcgen self-assigned this Feb 9, 2023
@kcgen kcgen added the enhancement New feature or enhancement of existing features label Feb 9, 2023
@kcgen kcgen changed the title Improve wildcard handling of imgmount file arguments Improve wildcard handling for imgmount file arguments Feb 9, 2023
@johnnovak
Copy link
Member

So this log message reads fine:

FAT: Mounted disk4.img as FAT12 volume with 2847 clusters

But these I find weird:

Drive A mounted? Should be the other way around, no?

disk1.img, disk2.img, and disk3.img mounted as drive A

@kcgen kcgen force-pushed the kc/improve-wildcard-sort-1 branch from 2694944 to a9e3866 Compare February 9, 2023 18:37
@kcgen
Copy link
Member Author

kcgen commented Feb 9, 2023

Drive A mounted? Should be the other way around, no?

disk1.img, disk2.img, and disk3.img mounted as drive A

I agree.. maybe they wanted the letter to be shown first (it stands out a bit more). but I agree, yours is more natural and preferred.

I swapped the drive letter and string:

MSG_Add("PROGRAM_MOUNT_STATUS_2","Drive %c is mounted as %s\n");

to 

MSG_Add("PROGRAM_MOUNT_STATUS_2","Images %s mounted as drive %c\n");

And it segfaults (because now the arguments need to be swapped) in these usage points:

src/dos/program_imgmount.cpp
src/dos/program_mount.cpp        
src/dos/program_mount_common.cpp

That's not a big deal 🙂

The bigger hit is that all the foreign strings (for PROGRAM_MOUNT_STATUS_2) would need to be flipped as well (otherwise those users will segfault):

  • contrib/resources/translations/utf-8/de.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/en.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/es.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/fr.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/it.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/nl.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/pl.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/ru.txt::PROGRAM_MOUNT_STATUS_2

I'd either have to hack those strings (and do a bad translation job) or ask the translators to fix them. Unfortunately this is feeling too stuck right now for this PR - might have to forgo this change 😭

@rderooy
Copy link
Collaborator

rderooy commented Feb 9, 2023

The bigger hit is that all the foreign strings (for PROGRAM_MOUNT_STATUS_2) would need to be flipped as well (otherwise those users will segfault):

  • contrib/resources/translations/utf-8/de.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/en.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/es.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/fr.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/it.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/nl.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/pl.txt::PROGRAM_MOUNT_STATUS_2
  • contrib/resources/translations/utf-8/ru.txt::PROGRAM_MOUNT_STATUS_2

I'd either have to hack those strings (and do a bad translation job) or ask the translators to fix them. Unfortunately this is feeling too stuck right now for this PR - might have to forgo this change sob

Dutch
Old:

:PROGRAM_MOUNT_STATUS_2
Schijf %c is gekoppeld als %s

New:

:PROGRAM_MOUNT_STATUS_2
Image %s gekoppeld als schijf %c

German
Old:

:PROGRAM_MOUNT_STATUS_2
Laufwerk %c ist eingebunden als %s

New:

:PROGRAM_MOUNT_STATUS_2
Image %s ist eingebunden als Laufwerk %c

@kcgen
Copy link
Member Author

kcgen commented Feb 9, 2023

@rderooy : one man translation team! Awesome.

Will go ahead with this :-)

@rderooy
Copy link
Collaborator

rderooy commented Feb 9, 2023

Thanks ;-)

I'm less fluent in French and Italian, but I think this should be correct...

Original French

Lecteur %c monté en tant que %s

Updated:

Image %s monté en tant que lecteur %c

Original Italian

Unità %c montata come %s

Updated:

Immagine %s montata come unità %c

@kcgen
Copy link
Member Author

kcgen commented Feb 9, 2023

Less fluent is far better than zero fluency for myself! Thanks for those @rderooy.

Russian, Spanish, And Polish left to go! 🔥

@kcgen
Copy link
Member Author

kcgen commented Feb 9, 2023

@rderooy : we need conjunction words for these languages, similar to how "and" is used:

Apple, banana, and pear.

I will add just that word as its own translated string, so we can use it in other translations too.

@rderooy
Copy link
Collaborator

rderooy commented Feb 9, 2023

Spanish, possibly. Close enough to Italian. Polish and Russian, no way ;-)

@rderooy
Copy link
Collaborator

rderooy commented Feb 9, 2023

Conjunction words:

Dutch: en
German: und
French: et
Italian: e
Spanish: y

@rderooy
Copy link
Collaborator

rderooy commented Feb 9, 2023

I think the Spanish translation would be

Imagen %s montada como unidad %c

@FeralChild64
Copy link
Collaborator

FeralChild64 commented Feb 9, 2023

Conjunction words:

Polish: i

Translation - old:

:PROGRAM_MOUNT_STATUS_2
Dysk %c jest zamontowany jako '%s'.

Translation - new:

:PROGRAM_MOUNT_STATUS_2
Obraz %s zamontowany jako dysk %c.

I'll need to review the Polish translation once again, there are probably more cases where the single quotation marks or the verbs should be removed (like in this case).

@rderooy French translation looks OK to me - but I'm also not fluent with this language.

@kcgen
Copy link
Member Author

kcgen commented Feb 9, 2023

@GranMinigun

help needed to translate "and" conjunction to Russian:

So far, I've got и (versus а, which contrasts)?

kcgen added 2 commits February 9, 2023 16:59
Also tidies up superfluous path specifications to reduce
visual clutter in screen and log output.
Includes:
 - Uses more readable comma-separated format
 - Adds the filenames to the console log messages
@kcgen kcgen force-pushed the kc/improve-wildcard-sort-1 branch from a9e3866 to 64c76b5 Compare February 10, 2023 01:43
@kcgen
Copy link
Member Author

kcgen commented Feb 10, 2023

@johnnovak , @rderooy , @FeralChild64 , @GranMinigun , @NicknineTheEagle , @Kappa971 , @Burrito78

Here are the updated mount status logs, do they look OK?

Regarding "drive C versus C drive", the latter is more correct so I've used that for English and Dutch, as my searches found those were the most prevalent and acceptable.

My searches in the other languages show the "drive C" prefix-approach is more common. Please shout if I got this wrong or if there are more tweaks.

2023-02-09_17-33

2023-02-09_17-38

2023-02-09_17-39

2023-02-09_17-38_1

2023-02-09_17-37_1

2023-02-09_17-37

2023-02-09_17-34_1

2023-02-09_17-34

@johnnovak
Copy link
Member

johnnovak commented Feb 10, 2023

2023-02-09_17-38_1

Looks good to me 👍🏻 Minor comment: there's a period at the end of the Polish (?) translation only. Probably should be removed for consistency?

@NicknineTheEagle
Copy link
Contributor

NicknineTheEagle commented Feb 10, 2023

Russian text should say "Образ FAT" instead of "Привод FAT".

@kcgen
Copy link
Member Author

kcgen commented Feb 10, 2023

Looks good to me 👍🏻 Minor comment: there's a period at the end of the Polish (?) translation only. Probably should be removed for consistency?

I think @FeralChild64 wanted it; but will let him decide.

Co-authored-by: Robert de Rooy <[email protected]>
Co-authored-by: FeralChild64 <[email protected]>
Co-authored-by: kcgen <[email protected]>
@kcgen kcgen force-pushed the kc/improve-wildcard-sort-1 branch from 64c76b5 to 4e989e4 Compare February 10, 2023 03:13
@kcgen
Copy link
Member Author

kcgen commented Feb 10, 2023

Russian text should say "Образ FAT" instead of "Привод FAT".

2023-02-09_19-13

added.

@GranMinigun
Copy link
Contributor

Ideally the comma before "и" should be dropped (Oxford comma is not a thing in Russian), but I'm nitpicking. I also see that everything is in singular form... gettext, so close yet so far away.

@Kappa971
Copy link
Contributor

2023-02-09_17-37_1

Seems ok to me 👍🏻

@Burrito78
Copy link
Collaborator

The Oxford comma did not actually originate at Oxford University in England. One can trace its origin in English guides from the early 20th century. The Oxford comma is "correct" in American Standard English but does not exist in other languages, nor is it mandatory in British or International English.
https://libguides.framingham.edu/c.php?g=894986&p=7278665

Also please change "FAT image" -> "FAT-Image" for german.

Thanks, looking good otherwise!

@johnnovak
Copy link
Member

The Oxford comma did not actually originate at Oxford University in England. One can trace its origin in English guides from the early 20th century. The Oxford comma is "correct" in American Standard English but does not exist in other languages, nor is it mandatory in British or International English.
https://libguides.framingham.edu/c.php?g=894986&p=7278665

Also please change "FAT image" -> "FAT-Image" for german.

Thanks, looking good otherwise!

Can you even call a filesystem FAT these days? Is that politically correct? Shall we rename it to LargeSized? :trollface:

@FeralChild64
Copy link
Collaborator

@kcgen @johnnovak You can remove period at the end of sequence in Polish translation if the original string does not have it. I’m going to check the remaining strings for consistency later.

@kcgen
Copy link
Member Author

kcgen commented Feb 10, 2023

https://libguides.framingham.edu/c.php?g=894986&p=7278665

Great reference @Burrito78 , especially those examples.

I took an engineering technical writing course (long ago), but the last comma was mandatory to differentiate the last "item" exactly like those examples show (and the confusion and legal troubles it can cause without it!)

This style also makes bullets and commas behave consistently (imagine stuffing the last two items on the same bullet!)

  • A
  • B
  • C
  • D

@kcgen
Copy link
Member Author

kcgen commented Feb 10, 2023

@Burrito78

2023-02-10_08-42

@FeralChild64

2023-02-10_08-43

I think that does it. Merging. Huge team effort - thanks everyone!

@kcgen kcgen merged commit d8f58b8 into main Feb 10, 2023
@delete-merged-branch delete-merged-branch bot deleted the kc/improve-wildcard-sort-1 branch February 10, 2023 16:54
@johnnovak
Copy link
Member

johnnovak commented Feb 10, 2023

https://libguides.framingham.edu/c.php?g=894986&p=7278665

Great reference @Burrito78 , especially those examples.

I took an engineering technical writing course (long ago), but the last comma was mandatory to differentiate the last "item" exactly like those examples show (and the confusion and legal troubles it can cause without it!)

This style also makes bullets and commas behave consistently (imagine stuffing the last two items on the same bullet!)

* A

* B

* C

* D

I'm a big fan of the Oxford comma too, and so are some of my Aussie colleagues. As @kcgen said, it removes ambiguity which is always a good thing. In general, I'm a comma maximalist! 😁 I use as much punctuation as I can; I see them as a courtesy to my readers to help them with parsing my sentences more easily.

@Burrito78
Copy link
Collaborator

https://www.germanwithnicole.com/blog/36237-sorry-there-is-no-oxford-comma-in-german

Nicole said it best.

So be sure to review your German texts when you've written a list und entfernen Sie das Oxford-Komma!

@johnnovak
Copy link
Member

johnnovak commented Feb 14, 2023

On the importance of commas; this is a real example from Hungarian history which is somewhat hard to translate, but it illustrates the concept.

TL;DR the queen was assassinated in the end, and the writer of the message wanted to discourage certain parties from the murder, but it can be actually interpreted both ways.

The original message went like this (without commas):

"Kill Queen you must not fear will be good if all agree I do not oppose"

And the two possible interpretations (the author of the messages claimed the second interpretation was correct, and was hence spared from execution):

"Kill Queen, you must not fear, will be good if all agree, I do not oppose"

"Kill Queen you must not, fear will be good, if all agree I do not, oppose"

@johnnovak johnnovak added the DOS Issues related to DOS integration or DOS commands label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOS Issues related to DOS integration or DOS commands enhancement New feature or enhancement of existing features
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants