On 3/8/20 6:49 PM, Eli Schwartz wrote: > On 3/8/20 6:39 PM, Carson Black wrote: >>> What is "cleaned", and how is the xargs program "cleaning" it? >> >> Excess whitespace is being trimmed using xargs. " a string >> " will get normalized to "a string" when passed through xargs. > > Examples of desktop files with this issue? I didn't find one like it on > my system. > >>> >>>> + >>>> + [[ -z "$cleaned" ]] && continue >>> >>> When will this be set but empty? >> >> Trailing semicolon in desktop file will result in a blank entry in the >> mimetypes array, >> resulting in a blank can-open-mimetype() provide without this code. > > $ mapfile -t -d ";" mimetypes < <(grep MimeType= > /usr/share/applications/qemu.desktop | cut -d '=' -f 2) > $ declare -p mimetypes > declare -a mimetypes=()
Not sure what I was thinking here, lol, it is in fact a problem when the Mimetypes= line *does* exist. A good way to solve this would be [[ -n ${mimetypes[-1]//$'\n'} ]] || unset mimetypes[-1] -- Eli Schwartz Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature