Howdy,

The patch '40_source_encoding_utf8.dpatch' needs updating as attached 
to this message.

Previously it would convert files to a temporary file created with 
default permissions 0600, which isn't correct. This version of the 
patch converts each file to a new file with the *same* permission mode 
as the original file.

-- 
 \        "I don't accept the currently fashionable assertion that any |
  `\       view is automatically as worthy of respect as any equal and |
_o__)                                   opposite view." —Douglas Adams |
Ben Finney <[EMAIL PROTECTED]>
#! /bin/bash
## 40_source_encoding_utf8.dpatch by Ben Finney <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Convert encoding of non-ASCII source files to UTF-8

set -o errexit

non_ascii_source_files="acls.c process.c help.c"
original_encoding=iso-8859-1
patched_encoding=utf-8

convert_encoding () {
    local in_encoding=$1
    local out_encoding=$2
    local in_file=$3

    local file_dir=$(dirname $in_file)
    local file_mode=$(stat --format "%a" $in_file)
    local out_file=$(tempfile --directory $file_dir --mode $file_mode)
    iconv --from-code $in_encoding --to-code $out_encoding $in_file > $out_file
    mv $out_file $in_file
}

dpatch_patch () {
    for file in $non_ascii_source_files ; do
        convert_encoding $original_encoding $patched_encoding $file
    done
}

dpatch_unpatch () {
    for file in $non_ascii_source_files ; do
        convert_encoding $patched_encoding $original_encoding $file
    done
}

DPATCH_LIB_NO_DEFAULT=1

. /usr/share/dpatch/dpatch.lib.sh

Attachment: signature.asc
Description: Digital signature

Reply via email to