This file is indexed.

/usr/bin/cdbs-edit-patch is in cdbs 0.4.156ubuntu4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh -e
# create or edit a cdbs simple-patchsys.mk patch
#
# (C) 2005 Martin Pitt <mpitt@debian.org>
#
#  This script is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 2 as
#  published by the Free Software Foundation.


# Stolen from quilt
patch_header()
{
    awk '
        $1 == "***" || $1 == "---" \
                { exit }
        /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision [0-9]+(\.[0-9]+)*$/ \
                { eat = eat $0 "\n"
                  next }
                { print eat $0
                  eat = "" }
        '
}

if [ -z "$1" ] || [ "$1" = "--help" ]; then
    echo "Usage: $0 <patch name>"
    exit 0
fi

dh_testdir

SRCDIR=$(pwd)
TMP=$(mktemp -t -d cdbs-new-patch.XXXXXX)
TMP2=$(mktemp -t cdbs-old-patch-header.XXXXXX)
trap "rm -rf $TMP $TMP2" 0 1 2 3 9 11 13 15

case $1 in
    *.diff|*.patch) PATCHNAME=$1;;
    *)              PATCHNAME=$1.patch;;
esac
PATCHNAME=${PATCHNAME#debian/patches/}

ORIGDIR=$(basename $(pwd))
NEWDIR=$ORIGDIR.new

mkdir -p debian/patches

# create clean source package in temporary dir
cp -a . $TMP/$ORIGDIR
cd $TMP/$ORIGDIR
debclean

# create an empty patch if necessary so that the following loop stops at the
# lexicographic patch position
[ -e "debian/patches/$PATCHNAME" ] || touch "debian/patches/$PATCHNAME" 

# remove all patches later than or equal to the one to edit
for p in $(find debian/patches -type f \( -name "*.diff" -o -name "*.patch" \) | LC_COLLATE=C sort -r); do
    rm -f "$p"
    pname=$(basename "$p")
    [ "$pname" != "$PATCHNAME" ] || break
done

debian/rules apply-patches

deb_tar_srcdir=$(sed -nr 's/^[[:space:]]*DEB_TAR_SRCDIR[[:space:]]*:?=[[:space:]]*//p' debian/rules)
if [ -n "$deb_tar_srcdir" ]; then
	deb_srcdir=build-tree/$deb_tar_srcdir
fi

# create new source dir
cp -a . $TMP/$NEWDIR
cd $TMP/$NEWDIR/$deb_srcdir

# if we edit a patch, apply the already existing one to the new directory
if [ -e "$SRCDIR/debian/patches/$PATCHNAME" ]; then
    echo -n "Applying already existing patch to edit directory at level"
    for level in 1 0 2; do
        echo -n " $level"
        if patch --dry-run -E -p$level < "$SRCDIR/debian/patches/$PATCHNAME" > /dev/null 2>&1; then
            if patch --no-backup-if-mismatch -V never -p$level < "$SRCDIR/debian/patches/$PATCHNAME" > /dev/null 2>&1; then
                echo " success"
                success=1
                break;
            fi
        fi
    done
    [ "$success" ] || {
        echo " failure"
        echo
        echo "Forcefully applying patch at level 1.  You have to fix the"
        echo "rejections manually."
        patch -p1 < "$SRCDIR/debian/patches/$PATCHNAME" || [ $? -eq 1 ]
    }
fi

echo "
You are now in a subshell in a cleaned copy of your source package.
Please make the changes necessary for the patch $PATCHNAME
in this directory and exit with status 0 to create/update the patch.
Exiting with a non-zero value will cancel the patch modification."

SH=$(getent passwd $USER | cut -f 7 -d:)
[ "$SH" ] || SH=/bin/sh

if $SH; then
    if [ -f $SRCDIR/debian/patches/$PATCHNAME ]; then
        cat $SRCDIR/debian/patches/$PATCHNAME | patch_header > $TMP2
        cat $TMP2 > $SRCDIR/debian/patches/$PATCHNAME
    fi
    cd $TMP
    diff -Nur -x '*.orig' -x '*~' $ORIGDIR/$deb_srcdir $NEWDIR/$deb_srcdir >> $SRCDIR/debian/patches/$PATCHNAME || [ $? -eq 1 ]

    # adjust paths in patches with build tree
    if [ -n "$deb_srcdir" ]; then
	sed -i "s_^\(---\|+++\) [^/]*/build-tree/_\1 _" $SRCDIR/debian/patches/$PATCHNAME
    fi
fi