MiSTer-devel / Updater_script_MiSTer

Bash script for updating MiSTer
GNU General Public License v3.0
76 stars 29 forks source link

Issues with CORE_INTERNAL_NAME for some cores #57

Open stefanerwinmayer opened 3 years ago

stefanerwinmayer commented 3 years ago

SD card created with: Mr. Fusion v2.2

There seems to be an issue with how the internal names of cores are built (Line 809 presumably the culprit). Running the updater for the first time on a new sd card produces partially the following in the logs:

Checking ao486
Downloading ao486_20210103.rbf to /media/fat/_Computer/ao486_20210103.rbf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   149  100   149    0     0    445      0 --:--:-- --:--:-- --:--:--   450

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   160  100   160    0     0    174      0 --:--:-- --:--:-- --:--:--  156k

 28 4116k   28 1157k    0     0   793k      0  0:00:05  0:00:01  0:00:04  793k
100 4116k  100 4116k    0     0  2181k      0  0:00:01  0:00:01 --:--:-- 6913k
Deleting old ao486 files
Creating /media/fat/games/AO486UART115200:4000000(Turbo 115200),MIDI directory
mkdir: cannot create directory ‘/media/fat/games/AO486UART115200:4000000(Turbo 115200),MIDI’: Invalid argument
Checking Gameboy
Downloading Gameboy_20210103.rbf to /media/fat/_Console/Gameboy_20210103.rbf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   153  100   153    0     0    481      0 --:--:-- --:--:-- --:--:--   487

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   164    0   164    0     0    196      0 --:--:-- --:--:-- --:--:--  160k

100 3657k  100 3657k    0     0  2167k      0  0:00:01  0:00:01 --:--:-- 2167k
Deleting old Gameboy files
Creating /media/fat/games/GAMEBOYSS3E000000:100000 directory
mkdir: cannot create directory ‘/media/fat/games/GAMEBOYSS3E000000:100000’: Invalid argument
Checking GBA
Downloading GBA_20201120.rbf to /media/fat/_Console/GBA_20201120.rbf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   145  100   145    0     0    434      0 --:--:-- --:--:-- --:--:--   438

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   156  100   156    0     0    177      0 --:--:-- --:--:-- --:--:--  152k

  9 4132k    9  373k    0     0   269k      0  0:00:15  0:00:01  0:00:14  269k
100 4132k  100 4132k    0     0  2142k      0  0:00:01  0:00:01 --:--:-- 6897k
Deleting old GBA files
Creating /media/fat/games/GBASS3E000000:100000 directory
mkdir: cannot create directory ‘/media/fat/games/GBASS3E000000:100000’: Invalid argument

Thank you very much for all your efforts!

stefanerwinmayer commented 3 years ago

Aside: The error messages come from the shell and do not contain the word 'error' like other errors. Makes them hard to spot.

Firebrandx commented 3 years ago

I found a 4th one in the cheats installation:

error: cannot create /media/fat/cheats/TGFX16/Ranma ? (CD)(Jpn) [].zip Invalid argument

I believe all 4 invalid arguments are due to using characters not allowed.

stefanerwinmayer commented 3 years ago

@Firebrandx I reported that one here: https://github.com/MiSTer-devel/Updater_script_MiSTer/issues/58

Firebrandx commented 3 years ago

Since it's the same type of error (invalid argument), I figured it didn't need a separate report. No worries either way.

cdewit commented 3 years ago

The issue is indeed with the value assigned to the CORE_INTERNAL_NAME variable: CORE_INTERNAL_NAME="$(curl $CURL_RETRY $SSL_SECURITY_OPTION -sSLf "${CORE_SOURCE_URL}?raw=true" | awk '/CONF_STR[^=]*=/,/;/' | grep -oE -m1 '".*?;' | sed 's/[";]//g')"

The non-greedy/lazy matching in the regular expression of the grep command seems to be unsupported and causes the issue (despite the -E (PATTERN is an extended regexp) option). Update: It seems that neither BRE (Basic Regular Expressions) nor ERE (Extended Regular Expressions) support non-greedy/lazy matching. PCRE (Perl-Compatible Regular Expressions) should support non-greedy/lazy matching but the used grep seems to lack the -P (Perl) option.

Example command that reproduces the issue: echo '"AO486;UART115200:4000000(Turbo 115200),MIDI;' | grep -oE -m1 '".*?;' Result: "AO486;UART115200:4000000(Turbo 115200),MIDI;

A possible fix could be avoiding non-greedy/lazy matching in the regular expression of the grep command, e.g.: echo '"AO486;UART115200:4000000(Turbo 115200),MIDI;' | grep -oE -m1 '"[^;]*;' Result: "AO486;

theypsilon commented 3 years ago

The fixes from @cdewit have been merged, I think this issue can be closed @stefanerwinmayer