The editor "Kate" offers to put 3 bytes "EF BB BF" in front of every text file optionally (enable under "configure Kate : open/save "). https://en.wikipedia.org/wiki/Byte_order_mark The BOM is invisible in Kate and will break a lot of softwares. The "EFBBBF" is visible in Hex-editor "Okteta" only. In particular, kbuildsycoca5 v. 5.46.0 on a current June 2018 NetRunner ARCH Rolling-release distro will break with a cryptic error message, if one used Kate with BOM enbabled to modify some "clickMe.desktop" file in a trivial manner and the .desktop file will no longer work, e.g. in Dolphin. kbuildsycoca5 should either manage to detect and work with a BOM or at least make a specific error message e.g. : "line 1 of the .desktop file contains a BOM as the first 3 bytes therefore kbuildsycoca5 is breaking. Please remove the BOM with a Hex editor such as Okteta." The error is somewhat nasty since both Kate and Kompare will always hide the BOM so you don't see what the heck is going on. How to reproduce: in a bash shell in subdir /home/YOURSELF/.local/share/kservices5/ServiceMenus/ run: touch kfind.desktop # now edit this kfind.desktop file with Kate and paste this content: [Desktop Entry] Type=Service X-KDE-ServiceTypes=KonqPopupMenu/Plugin,inode/directory X-KDE-Priority=TopLevel Actions=kfindhere; Comment=KFind from here, very handy ! path is being preset [Desktop Action kfindhere] Name=KFind Files or Folders Name[es]=Buscar archivos/carpetas Icon=kfind Exec=kfind %u # end of the kfind.desktop file is here # enable BOM in Kate-settings and save the file with a BOM # open kfind.desktop with okteta and verify that the first 3 bytes are EFBB... or something. # run kbuildsycoca5 # it will give an error in "line 1" because of the BOM # remove the BOM using Okteta, all will be working fine again if run "kbuildsycoca5"
alternatively, in Dolphin click and hover over KFind.desktop in any subdir whatsoever, it will show on right-click unless a BOM is present.
find -type f | while read file do if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ] then echo "found BOM in: $file" fi done # doesn't work with filenames that contain a line break
If you mark this as a junior job, please add information where the code needs to be changed. The git repository is usually sufficient.
[Desktop Entry] kate: byte-order-marker off; # the above line avoids the problem in Kate, would still be nice to fix it properly Type=Service X-KDE-ServiceTypes=KonqPopupMenu/Plugin,inode/directory X-KDE-Priority=TopLevel Actions=kfindhere; Comment=KFind from here, very handy ! path is being preset [Desktop Action kfindhere] Name=KFind Files or Folders Name[es]=Buscar archivos/carpetas Icon=kfind Exec=kfind %u # end of the kfind.desktop file is here