diff --git a/ChangeLog b/ChangeLog index 117d5b6..0b3fa5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,11 @@ Changes in version 1.10.1 * Makefile, Makefile.env, conf/* - Davide Madrisan: Split autospec.conf into several configuration files. ++ improvement + * pck-update - Davide Madrisan: + Check specfiles for CR and CRLF line terminators. + They can mislead the specfile parser. + ------------------------------------------------------------------------------- Changes in version 1.10.0 diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 554da2a..63335b6 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -430,6 +430,28 @@ assuming as specfile"": \`$spec_dir/$SRPM_SPECFILE'" [ -f "$SRPM_SPECFILE_WITH_PATH" ] || notify.error $"specfile not found"": \`$SRPM_SPECFILE_WITH_PATH'" + local specfile_mimetype + specfile_mimetype="$(LC_ALL=C file -p --brief "$SRPM_SPECFILE_WITH_PATH")" + notify.debug "$FUNCNAME: specfile_mimetype: $specfile_mimetype" + + case "$specfile_mimetype" in + # Microsoft line terminators... not good for the parser + *"with CRLF"*"line terminators"*) + notify.error $"\ +specfile with CRLF line terminators"": $SRPM_SPECFILE_WITH_PATH" + ;; + # MAC line terminators + *"with CR"*"line terminators"*) + notify.error $"\ +specfile with CR line terminators"": $SRPM_SPECFILE_WITH_PATH" + ;; + *"text"*) : ;; + *) notify.error "\ +specfile with an unsupported format"" ($specfile_mimetype)""\ +: $SRPM_SPECFILE_WITH_PATH" + ;; + esac + echo "SRPM_SPECFILE_WITH_PATH=\"$SRPM_SPECFILE_WITH_PATH\"" >> $infofile notify.debug "SRPM_SPECFILE_WITH_PATH = \"$SRPM_SPECFILE_WITH_PATH\""