This file is indexed.

/usr/bin/sup-import-dump is in sup-mail 0.12.1+git20120407.aaa852f-1+deb7u1.

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
#!/usr/bin/ruby1.9.1

require 'uri'
#require 'rubygems'
require 'trollop'
require "sup"; Redwood::check_library_version_against "git"

PROGRESS_UPDATE_INTERVAL = 15 # seconds

class AbortExecution < SystemExit
end

opts = Trollop::options do
  version "sup-import-dump (sup #{Redwood::VERSION})"
  banner <<EOS
Imports message state previously exported by sup-dump into the index.
sup-import-dump operates on the index only, so the messages must have already
been added using sup-sync. If you need to recreate the index, see sup-sync
--restore <filename> instead.

Messages not mentioned in the dump file will not be modified.

Usage:
  sup-import-dump [options] <dump file>

Options:
EOS
  opt :verbose, "Print message ids as they're processed."
  opt :ignore_missing, "Silently skip over messages that are not in the index."
  opt :warn_missing, "Warn about messages that are not in the index, but continue."
  opt :abort_missing, "Abort on encountering messages that are not in the index. (default)"
  opt :atomic, "Use transaction to apply all changes atomically."
  opt :dry_run, "Don't actually modify the index. Probably only useful with --verbose.", :short => "-n"
  opt :version, "Show version information", :short => :none

  conflicts :ignore_missing, :warn_missing, :abort_missing
end
Trollop::die "No dump file given" if ARGV.empty?
Trollop::die "Extra arguments given" if ARGV.length > 1
dump_name = ARGV.shift
missing_action = [:ignore_missing, :warn_missing, :abort_missing].find { |x| opts[x] } || :abort_missing

Redwood::start
index = Redwood::Index.init

index.lock_interactively or exit
begin
  num_read = 0
  num_changed = 0
  index.load
  index.begin_transaction if opts[:atomic]

  IO.foreach dump_name do |l|
    l =~ /^(\S+) \((.*?)\)$/ or raise "Can't read dump line: #{l.inspect}"
    mid, labels = $1, $2
    num_read += 1

    unless index.contains_id? mid
      if missing_action == :abort_missing
        $stderr.puts "Message #{mid} not found in index, aborting."
        raise AbortExecution, 10
      elsif missing_action == :warn_missing
        $stderr.puts "Message #{mid} not found in index, skipping."
      end

      next
    end

    m = index.build_message mid
    new_labels = labels.to_set_of_symbols

    if m.labels == new_labels
      puts "#{mid} unchanged" if opts[:verbose]
      next
    end

    puts "Changing flags for #{mid} from '#{m.labels.to_a * ' '}' to '#{new_labels.to_a * ' '}'" if opts[:verbose]
    num_changed += 1

    next if opts[:dry_run]

    m.labels = new_labels
    index.update_message_state m
  end

  index.commit_transaction if opts[:atomic]
  puts "Updated #{num_changed} of #{num_read} messages."
rescue AbortExecution
  index.cancel_transaction if opts[:atomic]
  raise
rescue Exception => e
  index.cancel_transaction if opts[:atomic]
  File.open("sup-exception-log.txt", "w") { |f| f.puts e.backtrace }
  raise
ensure
  index.save_index unless opts[:atomic]
  Redwood::finish
  index.unlock
end