@@ -134,13 +134,15 @@ sub create_extra_file
134134 open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
135135 print $fh " This is an extra file.\n " ;
136136 close ($fh );
137+ return ;
137138}
138139
139140# Add a file into the root directory of the backup.
140141sub mutilate_extra_file
141142{
142143 my ($backup_path ) = @_ ;
143144 create_extra_file($backup_path , " extra_file" );
145+ return ;
144146}
145147
146148# Add a file inside the user-defined tablespace.
@@ -155,6 +157,7 @@ sub mutilate_extra_tablespace_file
155157 slurp_dir(" $backup_path /pg_tblspc/$tsoid /$catvdir " );
156158 create_extra_file($backup_path ,
157159 " pg_tblspc/$tsoid /$catvdir /$tsdboid /extra_ts_file" );
160+ return ;
158161}
159162
160163# Remove a file.
@@ -163,6 +166,7 @@ sub mutilate_missing_file
163166 my ($backup_path ) = @_ ;
164167 my $pathname = " $backup_path /pg_xact/0000" ;
165168 unlink ($pathname ) || die " $pathname : $! " ;
169+ return ;
166170}
167171
168172# Remove the symlink to the user-defined tablespace.
@@ -180,13 +184,15 @@ sub mutilate_missing_tablespace
180184 {
181185 unlink ($pathname ) || die " $pathname : $! " ;
182186 }
187+ return ;
183188}
184189
185190# Append an additional bytes to a file.
186191sub mutilate_append_to_file
187192{
188193 my ($backup_path ) = @_ ;
189194 append_to_file " $backup_path /global/pg_control" , ' x' ;
195+ return ;
190196}
191197
192198# Truncate a file to zero length.
@@ -196,6 +202,7 @@ sub mutilate_truncate_file
196202 my $pathname = " $backup_path /global/pg_control" ;
197203 open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
198204 close ($fh );
205+ return ;
199206}
200207
201208# Replace a file's contents without changing the length of the file. This is
@@ -209,13 +216,15 @@ sub mutilate_replace_file
209216 open (my $fh , ' >' , $pathname ) || die " open $pathname : $! " ;
210217 print $fh ' q' x length ($contents );
211218 close ($fh );
219+ return ;
212220}
213221
214222# Corrupt the backup manifest.
215223sub mutilate_bad_manifest
216224{
217225 my ($backup_path ) = @_ ;
218226 append_to_file " $backup_path /backup_manifest" , " \n " ;
227+ return ;
219228}
220229
221230# Create a file that can't be opened. (This is skipped on Windows.)
@@ -224,6 +233,7 @@ sub mutilate_open_file_fails
224233 my ($backup_path ) = @_ ;
225234 my $pathname = " $backup_path /PG_VERSION" ;
226235 chmod (0, $pathname ) || die " chmod $pathname : $! " ;
236+ return ;
227237}
228238
229239# Create a directory that can't be opened. (This is skipped on Windows.)
@@ -232,6 +242,7 @@ sub mutilate_open_directory_fails
232242 my ($backup_path ) = @_ ;
233243 my $pathname = " $backup_path /pg_subtrans" ;
234244 chmod (0, $pathname ) || die " chmod $pathname : $! " ;
245+ return ;
235246}
236247
237248# Create a directory that can't be searched. (This is skipped on Windows.)
@@ -240,6 +251,7 @@ sub mutilate_search_directory_fails
240251 my ($backup_path ) = @_ ;
241252 my $pathname = " $backup_path /base" ;
242253 chmod (0400, $pathname ) || die " chmod $pathname : $! " ;
254+ return ;
243255}
244256
245257# rmtree can't cope with a mode 400 directory, so change back to 700.
@@ -248,4 +260,5 @@ sub cleanup_search_directory_fails
248260 my ($backup_path ) = @_ ;
249261 my $pathname = " $backup_path /base" ;
250262 chmod (0700, $pathname ) || die " chmod $pathname : $! " ;
263+ return ;
251264}
0 commit comments