EMULAB Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

The new forum is online, hope you enjoy it!

Pages: [1]   Go Down

Author Topic: Trimming of a leading space in a filename  (Read 3128 times)

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Trimming of a leading space in a filename
« on: 15 December 2022, 08:33 »

Hi Roman,

We ran into this issue with the dogfight entry in SoftList msx1_cass.xml.

<rom name="dogfights\ zero fighter - dog fighter (1985)(microbyte)(es)[bload'cas-',r].cas" size="8534" crc="94a480e2" sha1="da0f4e2660ca03e3403e7d22945ea9bae89ab571" />

Notice the leading space before the "zero".
I agree it being a bug (reported) that needs trimming, but is there a way for CMP to (always) warn if this is the case instead of doing it silently?
It would be easier to notice and report bugs like these.
It now took someone using RomVault (not trimming) to notice the 2 byte difference in result between the datfile and the ROMs set.

Also referring to:
https://www.emulab.it/forum/index.php?topic=5942
https://github.com/mamedev/mame/commit/f898e47c0335fd5469645dc0e6a1b8df2b67fae1

With kind regards, NU.
« Last Edit: 15 December 2022, 09:30 by newuzer »
Logged


Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #1 on: 15 December 2022, 09:33 »

Erm...since when does MAME use subfolders in its xmls?

Anyhow, cmpro does support them but for cmpro the rom name is the full (relative) path, including "dogfights\"...so a space in the middle somewhere is not checked at all since normally it's valid. I think I do trim the complete entry though (left/right)...but definetly not checking anything inside.

I take a note, but don't expect anything anytime soon.
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #2 on: 15 December 2022, 10:07 »

It was an entry from a generated merged XML, not the raw XML ;)
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #3 on: 15 December 2022, 10:20 »

But wouldn't it then be a job for the generator to trim?
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #4 on: 15 December 2022, 10:27 »

No, it's something clrmamepro changes from source to end result, so the warning should be there IMO.
The generated entry (filename) is the same as the RAW source XML.
« Last Edit: 15 December 2022, 10:30 by newuzer »
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #5 on: 15 December 2022, 10:36 »

Erm..no, cmpro does not change anything!
If the dat holds the "\ ", then it's taken over. So again: how was the dat being generated?
If you've exported it with cmpro, then the original dat (before merge) holds the " " or you have a space in your naming patter (profiler settings: %f\%1 -> %f\ %1)
« Last Edit: 15 December 2022, 10:37 by Roman »
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #6 on: 15 December 2022, 13:20 »

The ROM entries in the generated (not with CMP but with SabreTools) datfiles are 1-on-1 copies of the original raw XML file entries.
Hence the reference to the commit that fixes the original XML, which contained the leading space in the first place.
After rebuilding with CMP, the filename in the zipfile does not have the leading space.
Apparently with RomVault it does.
So somewhere in the process, the leading space is lost.
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #7 on: 15 December 2022, 13:54 »

Well, most likely the archive operation (where maybe a file unpack to disk is involved) kills the space since I assume that 7z / zip unpack will create the file on disk without the leading space....and then the file is repacked to the destination. Maybe even the OS itself kills the space, too.

So...what are your rebuilder settings, if 7z is involved, the files will definetly be unpacked first and recompressed via 7z.exe from your disk....
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #8 on: 15 December 2022, 14:35 »

Everything default, no 7z involved, just zip.
Yes, the OS kills the leading space.
« Last Edit: 15 December 2022, 14:36 by newuzer »
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #9 on: 16 December 2022, 09:31 »

Ok, I had a closer look.
If you have a datfile with "bla\ blabla", the space gets already trimmed when the datfile is loaded/parsed.
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #10 on: 17 December 2022, 08:12 »

Ah, great, good catch.
Would it be possible to add a warning to the parser?
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #11 on: 17 December 2022, 12:00 »

Possible yes, however pretty unlikely since there is no real development going on these days.....I put it on the list though
Logged

Roman

  • Global Moderator
  • Member
  • ***
  • Karma: 113
  • Offline Offline
  • Posts: 3292
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 108.0.0.0 Chrome 108.0.0.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #12 on: 18 December 2022, 15:15 »

Actually I saw that a new zip archive lib is out.....so I got a reason to update cmpro....and quickly added your request
Logged

newuzer

  • Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 33
  • Operating System:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 108.0 Firefox 108.0
    • View Profile
Re: Trimming of a leading space in a filename
« Reply #13 on: 22 December 2022, 16:33 »

Neat, thanks!
Works like a charm.
Happy holidays!
« Last Edit: 22 December 2022, 17:27 by newuzer »
Logged
Pages: [1]   Go Up
 

Page created in 0.164 seconds with 21 queries.