I have recently upgraded from 13.2, where all partitions were ext4 to Leap 42.2, where the root partition is Btrfs and /home is XFS as recommended. I have a networked LibreELEC/KODI media server with an ext4 file system. This has over 1000 folders and filenames incorporating a colon character. When I mount the media server from the openSUSE computer and use Dolphin in Super User mode, I can see all the folders correctly on the media server. However, where the folder name has a colon character in it, Dolphin displays no files in that folder. Where there is no colon character in the folder name, the files are all visible.
This behaviour has repercussions for the file tags. Puddletag can no longer see any tags for files in these folders. The system worked perfectly in openSUSE 13.2 and as far as I know, the colon is an acceptable character in Linux filesystems. Extensive searches on this problem have failed to reveal the cause and I am completely baffled. I would be very grateful if anyone knows of a solution.
Thanks for replying so promptly, nrickert. Funny - I woke up this morning thinking I’m using a CIFS mount and maybe this could be the issue.
LibreELEC is described as “just enough OS Linux software appliance distro for Kodi.” Effectively LibreELEC has Kodi running as its only application but Samba has been implemented for several reasons, not just file sharing, hence mounting via CIFS. This used to work perfectly in openSUSE 13.2 but does not in Leap 42.2. I can only think that something has changed to prevent the colon being used since, as you say, it is an illegal character in Windows. Maybe it’s a newer version of Samba.
It looks as though my only options are to replace all the colons in the file and folder names or to implement an NFS server in LibreELEC, unless there is some way to get around the prohibition of this character.
I thought I might have found a simple way round this problem by using the mount option **mapchars **but it had no effect. I don’t know why, but it looks as though my options remain as above.
If it is any use, here is my script for removing colons from file names.
#! /bin/sh -
## $Id: $
### DECOLONIZE - remove colons from file name
# -d (default) delete the colon (or other) character
# -s x replace colon (or other) with substitute x.
# -c y the character to replace (defaults to ':')
USAGE="decolonize -d -s x -c y ] file"
# defaults
chartochange=':'
replacement=''
while getopts dc:s: op
do
case "$op" in
d) replacement='' ;;
c) chartochange="$OPTARG" ;;
s) replacement="$OPTARG" ;;
*) echo "$USAGE" >&2
exit 1 ;;
esac
done
shift `expr $OPTIND - 1 || :` ## sigh! expr gives status 1 if answer=0
### sanity check. Should check that "$chartochange" is of length 1 and
### "$replacement" is of length 0 or 1
### add check later
## rename one file
renamefile() {
file=`echo "/$1" | sed -e 's=.*/\(^/]*\)$=\1='`
if "$1" = "$file" ] ; then
path=""
else
path=`echo "$1" | sed 's=\(.*/\)^/]*$=\1='`
fi
if "$replacement" = "" ] ; then
newfile=`echo "$file" | tr -d "$chartochange"`
else
newfile=`echo "$file" | tr "$chartochange" "$replacement"`
fi
if "$newfile" != "$file" ] ; then
mv "$path$file" "$path$newfile"
fi
}
for f in "$@"
do
renamefile "$f"
done
You can also try enclosing any text strings within quotes, that instructs the machine to not interpret any special characters including colons as text and not as an operator.
In other words, modify the commands you use… not every label.
But, in the long run of course avoiding the possibility in the first place will mean fewer possible problems.
I’m not sure why but I had some problems using a minus sign in file names. It was a long time ago and became apparent when I searched for files to move to a back up before an upgrade. Now i stick to underscore but prefer to make use of capitalisation. After all keyboards do have a shift key.
rnickert - thank you for your script, which looks very handy and I may end up having to use something like this. I will exhaust other possibilities first, because the colon is useful and logical in the file naming and tagging and the thought of having to change to another character in over 1000 files is rather daunting.
tsu - unfortunately I don’t think this is a solution as the current setup uses puddletag to edit the tags in the music library. With this colon problem, not only do files within directories with a colon in their names not appear in the file manager, but the puddletag window is completely blank.
ajohnw - I have not (yet) seen a problem with any other character. Obviously, there are characters which are legitimate in Linux but not allowed in Windows file systems, the colon being one. Since both the media centre computer and the computer through which access is obtained to the media centre run Linux, there is no intrinsic problem here. The issue is that the generic release of LibreELEC has only a Samba server, hence restricting the mount method to CIFS.
One solution mentioned was to install an NFS server in LibreELEC, which does have the drawback that the system is no longer generic, so would need attention every time there was a version change. Another idea which has just occurred to me is that it may be possible to install a tag editor in LibreELEC, thereby obviating the need to use a second computer for access. These two possibilities strictly take me outside the remit of this thread, which was to establish the cause of the colon problem and why it had suddenly manifested itself in the change from OpenSUSE 13.2 to Leap 42.2. This is now sufficiently clear, thanks to your replies and while the problem is not yet actually solved, I think I need to turn my attention to LibreELEC rather than OpenSUSE.
If I manage to achieve a satisfactory result I will report back, in case the information is useful to others.
If you’re using a specific client software like puddletag,
Then you should submit a bug report to that project…
I’m sure that they would want to know about the problem because it’s more than just an inconvenience, it’s a potential security flaw. possibly exploitable.
I may be wrong, but I don’t think it is a problem with puddletag. My file browser can no longer “see” the files in folders with a colon in the folder name. I used a simple CIFS mount with OpenSUSE 13.2 and its predecessors and it worked fine. The problem has occurred with the upgrade to Leap 42.2. I suppose I should not really be surprised if Samba does not now allow characters illegal in Windows file systems. The bigger surprise is perhaps that it once did.
Thanks Leen. Yes, I can and do SSH into the media server and then of course, all is well with the files and I can see them all correctly, colons included. Unfortunately this does not help with puddletag unless I can install this (or another tag editor) in LibreELEC on the media server itself. Because LibreELEC is a minimal distro, this is not straightforward, but I have asked the question on the LibreELEC forum.
OK, firstly, apologies for the long delay. I have been up to my ears preparing end of year accounts for my local charity - and I’m not an accountant.
In the meantime I have established that there is not going to be a version of LibreELEC which incorporates NFS functionality. Samba works for the great majority of people and NFS is therefore not seen as a priority. It also seems unlikely that the ability to deal with colons in filenames will return to Samba any time soon. So my only option is to change the colons for something else.
@rnickert, I have tested your script and it works brilliantly, thank you. It would be nice to have the facility for it to be recursive, but unfortunately my ability with shell scripts is not up to the job. However, I can deal with all the folders in one step, then go into each folder and do the same with all the files therein, so the task is not too daunting.
Once again, thank you all for your comments and especially to @rnickert for the real time-saver.