projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.gitignore update.
[cumulus.git]
/
contrib
/
restore.pl
diff --git
a/contrib/restore.pl
b/contrib/restore.pl
index
96cf4b4
..
98ae277
100755
(executable)
--- a/
contrib/restore.pl
+++ b/
contrib/restore.pl
@@
-88,8
+88,8
@@
sub load_ref {
my $ref_str = shift;
# Check for special objects before attempting general parsing.
my $ref_str = shift;
# Check for special objects before attempting general parsing.
- if ($ref_str =~ m/^zero\[(
\d+)\+
(\d+)\]$/) {
- return "\0" x ($
2
+ 0);
+ if ($ref_str =~ m/^zero\[(
(\d+)\+)?
(\d+)\]$/) {
+ return "\0" x ($
3
+ 0);
}
# Try to parse the object reference string into constituent pieces. The
}
# Try to parse the object reference string into constituent pieces. The
@@
-122,12
+122,17
@@
sub load_ref {
# If a range was specified, then only a subset of the bytes of the object
# are desired. Extract just the desired bytes.
if ($range) {
# If a range was specified, then only a subset of the bytes of the object
# are desired. Extract just the desired bytes.
if ($range) {
- if ($range !~ m/^\[(
\d+)\+
(\d+)\]$/) {
+ if ($range !~ m/^\[(
(\d+)\+)?
(\d+)\]$/) {
die "Malformed object range: $range";
}
my $object_size = length $contents;
die "Malformed object range: $range";
}
my $object_size = length $contents;
- my ($start, $length) = ($1 + 0, $2 + 0);
+ my ($start, $length);
+ if (defined($1)) {
+ ($start, $length) = ($2 + 0, $3 + 0);
+ } else {
+ ($start, $length) = (0, $3 + 0);
+ }
if ($start >= $object_size || $start + $length > $object_size) {
die "Object range $range falls outside object bounds "
. "(actual size $object_size)";
if ($start >= $object_size || $start + $length > $object_size) {
die "Object range $range falls outside object bounds "
. "(actual size $object_size)";
@@
-354,7
+359,7
@@
sub process_metadata {
# Try to parse the data as "key: value" pairs of file metadata. Also
# handle continuation lines, which start with whitespace and continue
# the previous "key: value" pair.
# Try to parse the data as "key: value" pairs of file metadata. Also
# handle continuation lines, which start with whitespace and continue
# the previous "key: value" pair.
- if ($line =~ m/^(
\w
+):\s*(.*)$/) {
+ if ($line =~ m/^(
[-\w]
+):\s*(.*)$/) {
$info{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
$info{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
@@
-404,7
+409,7
@@
while (defined($line = <DESCRIPTOR>)) {
# lines.
chomp $line;
# lines.
chomp $line;
- if ($line =~ m/^(
\w
+):\s*(.*)$/) {
+ if ($line =~ m/^(
[-\w]
+):\s*(.*)$/) {
$descriptor{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
$descriptor{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {