Skip to content
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

Knulli renames all my files to lowercase #81

Open
erganmedia opened this issue Jul 23, 2024 · 4 comments
Open

Knulli renames all my files to lowercase #81

erganmedia opened this issue Jul 23, 2024 · 4 comments

Comments

@erganmedia
Copy link

erganmedia commented Jul 23, 2024

Knulli build version

20240721

Your architecture

RG35XX H

Issue description

After using the network transfer feature to copy my portmaster files to the ports folder, knulli suddenly changed all my filenames (not only the files I copied) to lowercase. Now I lost all my Favourites and also all my cover images do not match anymore with the rom names, so I don't see any cover art anymore.
I don't know if network transfer caused this, or if there is some weird knulli behaviour.

I am using a one card setup.

Detailed reproduction steps

my assumption is that this renaming was caused by the ext4 file format.

Details of any attempts to fix this yourself

No response

Details of any modifications you have made to Knulli.

none

Logs and data

No response

@HoroTW
Copy link

HoroTW commented Jul 23, 2024

Hi there,

First of all, sorry to hear that!

Because ext4 is a case-sensitive filesystem (by default) and does not inherently change the case of filenames. In fact, it ensures that filenames retain their case-sensitivity, i.e. File.txt and file.txt are considered completely different files.... So it's unlikely that ext4 itself is the cause of your filenames being converted to lowercase...

I'm at a loss as to how this could happen but lets clear some more related things, maybe we can find out what happened:

  1. Did you use an SMB network share or how did you transfer the files (there are other options such as SFTP)
  2. What program did you use for the transfer?
  3. Are you using Windows as your operating system?

But even with all that, it is very unlikely that ALL files were changed to lowercase...
However, I went ahead and checked Knullis Samba and mount settings, but I see nothing that would directly cause filenames to be converted to lowercase...

I'm not aware of any script in Knulli that would cause this... You mentioned you copied a port (these run scripts as part of their installation and some do rename things ... so maybe there is a way for that....)

  1. Which port(s) did you copy, maybe the problem lies in the script of the port

~Horo

@erganmedia
Copy link
Author

erganmedia commented Jul 24, 2024

  1. I believe it was the SMB network share because it appeared on my Mac as a network folder.
  2. Finder app in macOS
  3. macOS :)
  4. GTA Vice City, Need For Speed 2 SE, Tamagotchi, Pixelheat, Space Cadet Pinball.

But now that you mention it, it makes sense that one of those ports renamed everything. I believe that after trying the Tamagotchi, all my files were renamed. (at least this was when I realised it)

//edit: BTW, it was not possible to start the Need For Speed 2 SE port with Knulli. I checked the script and noticed that it renames some files to lowercase. Since I couldn't get the port to work, I suspect that this script might be causing the renaming issue. I also tried to install Need For Speed on Muos, and it worked fine. I'm not asking you to debug the PortMaster script for NFS, but if it indeed causes the renaming issue, it could potentially affect all Knulli users. You might find this information relevant.

Just in case you're interested, here's the script

#!/bin/bash

XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}

if [ -d "/opt/system/Tools/PortMaster/" ]; then
  controlfolder="/opt/system/Tools/PortMaster"
elif [ -d "/opt/tools/PortMaster/" ]; then
  controlfolder="/opt/tools/PortMaster"
elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then
  controlfolder="$XDG_DATA_HOME/PortMaster"
else
  controlfolder="/roms/ports/PortMaster"
fi

source $controlfolder/control.txt
source $controlfolder/device_info.txt
export PORT_32BIT="Y"

[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"

get_controls

GAMEDIR=/$directory/ports/nfs2se
CONFDIR="$GAMEDIR/conf/"

CUR_TTY=/dev/tty0
$ESUDO chmod 666 $CUR_TTY

> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1

cd $GAMEDIR

export LD_LIBRARY_PATH="/usr/lib/arm-linux-gnueabihf/":"/usr/lib32":"$GAMEDIR/libs/":"$LD_LIBRARY_PATH"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"

$ESUDO rm -rf ~/.nfs2se
ln -sfv /$directory/ports/nfs2se/conf/.nfs2se  ~/


# Process directories
find . -depth -type d | grep -e "[A-Z]" | while read -r dir; do
    newdir=$(echo "$dir" | tr '[A-Z]' '[a-z]' | sed 's/-1$//')
    
    # Simple progress message
    echo "Renaming $dir" > "$CUR_TTY"
    
    mv "$dir" "$dir-1" > "$CUR_TTY"
    mv "$dir-1" "$newdir" > "$CUR_TTY"
done

# Process files
find . -type f | grep -e "[A-Z]" | while read -r file; do
    newfile=$(echo "$file" | tr '[A-Z]' '[a-z]' | sed 's/-1$//')
    
    # Simple progress message
    echo "Renaming $file" > "$CUR_TTY"
    
    mv "$file" "$file-1" > "$CUR_TTY"
    mv "$file-1" "$newfile" > "$CUR_TTY"
done

#export TEXTINPUTINTERACTIVE="Y"

$GPTOKEYB "nfs2se" -c "./nfs2se.gptk" &
$GAMEDIR/nfs2se
$ESUDO kill -9 $(pidof gptokeyb)
$ESUDO systemctl restart oga_events &
printf "\033c" > /dev/tty0

@JoeyNRG
Copy link

JoeyNRG commented Dec 27, 2024

The provided script primarily focuses on renaming files and directories within the specified $GAMEDIR. It achieves this by, Identifying Target Files and Directories. Uses find command to locate files and directories containing uppercase letters. Filters the results using grep -e "[A-Z]". Creates a temporary renamed file or directory by appending "-1" to the original name. Renames the original file or directory to the temporary name. Renames the temporary name to the lowercase version. The script's renaming operations are confined to the $GAMEDIR directory and its subdirectories. It does not extend to directories outside of this scope. I don't think this is the problem and it's probably more to do with how your MAC's SMB handling is set up? I'm sure I had this issue before when using samba but can't remember the exact issue to fix.

@HoroTW
Copy link

HoroTW commented Jan 2, 2025

But why would Mac rename all directories on an SMB share... it would be kinda crazy if it did that for all SMB shares (e.g. a multi-TB NAS can host maaaaaany files 😅) and I would hope that MacOS wouldn't screw up that badly...

Maybe I'm missing something? ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants