@@ -134,13 +134,15 @@ sub create_extra_file
134
134
open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
135
135
print $fh " This is an extra file.\n " ;
136
136
close ($fh );
137
+ return ;
137
138
}
138
139
139
140
# Add a file into the root directory of the backup.
140
141
sub mutilate_extra_file
141
142
{
142
143
my ($backup_path ) = @_ ;
143
144
create_extra_file($backup_path , " extra_file" );
145
+ return ;
144
146
}
145
147
146
148
# Add a file inside the user-defined tablespace.
@@ -155,6 +157,7 @@ sub mutilate_extra_tablespace_file
155
157
slurp_dir(" $backup_path /pg_tblspc/$tsoid /$catvdir " );
156
158
create_extra_file($backup_path ,
157
159
" pg_tblspc/$tsoid /$catvdir /$tsdboid /extra_ts_file" );
160
+ return ;
158
161
}
159
162
160
163
# Remove a file.
@@ -163,6 +166,7 @@ sub mutilate_missing_file
163
166
my ($backup_path ) = @_ ;
164
167
my $pathname = " $backup_path /pg_xact/0000" ;
165
168
unlink ($pathname ) || die " $pathname : $! " ;
169
+ return ;
166
170
}
167
171
168
172
# Remove the symlink to the user-defined tablespace.
@@ -180,13 +184,15 @@ sub mutilate_missing_tablespace
180
184
{
181
185
unlink ($pathname ) || die " $pathname : $! " ;
182
186
}
187
+ return ;
183
188
}
184
189
185
190
# Append an additional bytes to a file.
186
191
sub mutilate_append_to_file
187
192
{
188
193
my ($backup_path ) = @_ ;
189
194
append_to_file " $backup_path /global/pg_control" , ' x' ;
195
+ return ;
190
196
}
191
197
192
198
# Truncate a file to zero length.
@@ -196,6 +202,7 @@ sub mutilate_truncate_file
196
202
my $pathname = " $backup_path /global/pg_control" ;
197
203
open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
198
204
close ($fh );
205
+ return ;
199
206
}
200
207
201
208
# Replace a file's contents without changing the length of the file. This is
@@ -209,13 +216,15 @@ sub mutilate_replace_file
209
216
open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
210
217
print $fh ' q' x length ($contents );
211
218
close ($fh );
219
+ return ;
212
220
}
213
221
214
222
# Corrupt the backup manifest.
215
223
sub mutilate_bad_manifest
216
224
{
217
225
my ($backup_path ) = @_ ;
218
226
append_to_file " $backup_path /backup_manifest" , " \n " ;
227
+ return ;
219
228
}
220
229
221
230
# Create a file that can't be opened. (This is skipped on Windows.)
@@ -224,6 +233,7 @@ sub mutilate_open_file_fails
224
233
my ($backup_path ) = @_ ;
225
234
my $pathname = " $backup_path /PG_VERSION" ;
226
235
chmod (0, $pathname ) || die " chmod $pathname : $! " ;
236
+ return ;
227
237
}
228
238
229
239
# Create a directory that can't be opened. (This is skipped on Windows.)
@@ -232,6 +242,7 @@ sub mutilate_open_directory_fails
232
242
my ($backup_path ) = @_ ;
233
243
my $pathname = " $backup_path /pg_subtrans" ;
234
244
chmod (0, $pathname ) || die " chmod $pathname : $! " ;
245
+ return ;
235
246
}
236
247
237
248
# Create a directory that can't be searched. (This is skipped on Windows.)
@@ -240,6 +251,7 @@ sub mutilate_search_directory_fails
240
251
my ($backup_path ) = @_ ;
241
252
my $pathname = " $backup_path /base" ;
242
253
chmod (0400, $pathname ) || die " chmod $pathname : $! " ;
254
+ return ;
243
255
}
244
256
245
257
# rmtree can't cope with a mode 400 directory, so change back to 700.
@@ -248,4 +260,5 @@ sub cleanup_search_directory_fails
248
260
my ($backup_path ) = @_ ;
249
261
my $pathname = " $backup_path /base" ;
250
262
chmod (0700, $pathname ) || die " chmod $pathname : $! " ;
263
+ return ;
251
264
}
0 commit comments