Disallowed -clone to overwrite existing nodes

This commit is contained in:
Thomas Schmitt 2011-02-02 17:41:52 +00:00
parent ed04ef8aba
commit ad30951fa5
6 changed files with 69 additions and 65 deletions

View File

@ -1385,7 +1385,7 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
char *leafname; char *leafname;
IsoImage *volume; IsoImage *volume;
IsoDir *new_parent; IsoDir *new_parent;
IsoNode *origin_node, *dir_node, *new_node, *dest_node= NULL; IsoNode *origin_node, *dir_node, *new_node;
ret= Xorriso_get_volume(xorriso, &volume, 0); ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret <= 0) if(ret <= 0)
@ -1402,16 +1402,13 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
if(dest_ret<0) if(dest_ret<0)
return(dest_ret); return(dest_ret);
if(dest_ret > 0) { if(dest_ret > 0) {
ret= Xorriso_node_from_path(xorriso, volume, eff_dest, &dest_node, 0); if(eff_dest[0] == 0)
if(ret <= 0) strcpy(eff_dest, "/");
return(ret); sprintf(xorriso->info_text,
if(dest_node == origin_node) { "Cloning: Copy address already exists : ");
sprintf(xorriso->info_text, Text_shellsafe(eff_dest, xorriso->info_text, 1);
"Cloning: Original and copy have the same iso_rr_path: "); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
Text_shellsafe(eff_dest, xorriso->info_text, 1); return(0);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
} else { } else {
/* obtain eff_dest address despite it does not exist */ /* obtain eff_dest address despite it does not exist */
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest, 2); ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest, 2);
@ -1419,11 +1416,6 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
return(ret); return(ret);
} }
ret= Xorriso_overwrite_dest(xorriso, boss_iter,
eff_dest, dest_ret, "Cloning", 0);
if(ret <= 0)
return(ret);
/* Obtain parent path and leaf name */ /* Obtain parent path and leaf name */
strcpy(dir_adr, eff_dest); strcpy(dir_adr, eff_dest);
for(l= strlen(dir_adr); l > 0; ) { for(l= strlen(dir_adr); l > 0; ) {

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Jan 29, 2011" .TH XORRISO 1 "Feb 02, 2011"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -1053,12 +1053,15 @@ other file causes a FAILURE event.
\fB\-clone\fR iso_rr_path_original iso_rr_path_copy \fB\-clone\fR iso_rr_path_original iso_rr_path_copy
Create a copy of the ISO file object iso_rr_path_original with the new Create a copy of the ISO file object iso_rr_path_original with the new
address iso_rr_path_copy. If the original is a directory then copy all address iso_rr_path_copy. If the original is a directory then copy all
files and directories underneath. Boot catalog are not copied but files and directories underneath. An eventual boot catalog file gets
silently ignored. not copied but is silently ignored.
.br .br
The copied ISO file objects have the same attributes. Copied data files The copied ISO file objects have the same attributes. Copied data files
refer to the same content source as their originals. refer to the same content source as their originals.
The copies may then be manipulated independendly of their originals. The copies may then be manipulated independendly of their originals.
.br
This command will refuse execution if the address iso_rr_path_copy
already exists in the ISO tree.
.TP .TP
.B Settings for file insertion: .B Settings for file insertion:
.TP .TP

View File

@ -990,11 +990,13 @@ filesystem.
-clone iso_rr_path_original iso_rr_path_copy -clone iso_rr_path_original iso_rr_path_copy
Create a copy of the ISO file object iso_rr_path_original with the Create a copy of the ISO file object iso_rr_path_original with the
new address iso_rr_path_copy. If the original is a directory then new address iso_rr_path_copy. If the original is a directory then
copy all files and directories underneath. Boot catalog are not copy all files and directories underneath. An eventual boot
copied but silently ignored. catalog file gets not copied but is silently ignored.
The copied ISO file objects have the same attributes. Copied data The copied ISO file objects have the same attributes. Copied data
files refer to the same content source as their originals. The files refer to the same content source as their originals. The
copies may then be manipulated independendly of their originals. copies may then be manipulated independendly of their originals.
This command will refuse execution if the address iso_rr_path_copy
already exists in the ISO tree.
 
File: xorriso.info, Node: SetInsert, Next: Manip, Prev: Insert, Up: Options File: xorriso.info, Node: SetInsert, Next: Manip, Prev: Insert, Up: Options
@ -4451,45 +4453,45 @@ Node: Options23227
Node: AqDrive24835 Node: AqDrive24835
Node: Loading27741 Node: Loading27741
Node: Insert40885 Node: Insert40885
Node: SetInsert49744 Node: SetInsert49874
Node: Manip58311 Node: Manip58441
Node: CmdFind66992 Node: CmdFind67122
Node: Filter77416 Node: Filter77546
Node: Writing81765 Node: Writing81895
Node: SetWrite88054 Node: SetWrite88184
Node: Bootable101664 Node: Bootable101794
Node: Jigdo113971 Node: Jigdo114101
Node: Charset118229 Node: Charset118359
Node: Exception120980 Node: Exception121110
Node: DialogCtl125495 Node: DialogCtl125625
Node: Inquiry128082 Node: Inquiry128212
Node: Navigate132415 Node: Navigate132545
Node: Verify140310 Node: Verify140440
Node: Restore148899 Node: Restore149029
Node: Emulation155555 Node: Emulation155685
Node: Scripting164598 Node: Scripting164728
Node: Frontend170160 Node: Frontend170290
Node: Examples171455 Node: Examples171585
Node: ExDevices172624 Node: ExDevices172754
Node: ExCreate173258 Node: ExCreate173388
Node: ExDialog174532 Node: ExDialog174662
Node: ExGrowing175794 Node: ExGrowing175924
Node: ExModifying176596 Node: ExModifying176726
Node: ExBootable177097 Node: ExBootable177227
Node: ExCharset177644 Node: ExCharset177774
Node: ExPseudo178472 Node: ExPseudo178602
Node: ExCdrecord179366 Node: ExCdrecord179496
Node: ExMkisofs179681 Node: ExMkisofs179811
Node: ExGrowisofs180684 Node: ExGrowisofs180814
Node: ExException181808 Node: ExException181938
Node: ExTime182262 Node: ExTime182392
Node: ExIncBackup182721 Node: ExIncBackup182851
Node: ExRestore186289 Node: ExRestore186419
Node: ExRecovery187258 Node: ExRecovery187388
Node: Files187824 Node: Files187954
Node: Seealso189052 Node: Seealso189182
Node: Legal189576 Node: Legal189706
Node: CommandIdx190498 Node: CommandIdx190628
Node: ConceptIdx204797 Node: ConceptIdx204927
 
End Tag Table End Tag Table

View File

@ -44,7 +44,7 @@
@c man .\" First parameter, NAME, should be all caps @c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1) @c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Jan 29, 2011" @c man .TH XORRISO 1 "Feb 02, 2011"
@c man .\" Please adjust this date whenever revising the manpage. @c man .\" Please adjust this date whenever revising the manpage.
@c man .\" @c man .\"
@c man .\" Some roff macros, for reference: @c man .\" Some roff macros, for reference:
@ -1317,12 +1317,15 @@ other file causes a FAILURE event.
@cindex Directory, copy, -clone @cindex Directory, copy, -clone
Create a copy of the ISO file object iso_rr_path_original with the new Create a copy of the ISO file object iso_rr_path_original with the new
address iso_rr_path_copy. If the original is a directory then copy all address iso_rr_path_copy. If the original is a directory then copy all
files and directories underneath. Boot catalog are not copied but files and directories underneath. An eventual boot catalog file gets
silently ignored. not copied but is silently ignored.
@* @*
The copied ISO file objects have the same attributes. Copied data files The copied ISO file objects have the same attributes. Copied data files
refer to the same content source as their originals. refer to the same content source as their originals.
The copies may then be manipulated independendly of their originals. The copies may then be manipulated independendly of their originals.
@*
This command will refuse execution if the address iso_rr_path_copy
already exists in the ISO tree.
@end table @end table
@c man .TP @c man .TP
@c man .B Settings for file insertion: @c man .B Settings for file insertion:

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.02.01.185830" #define Xorriso_timestamP "2011.02.02.174154"

View File

@ -112,6 +112,9 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag);
bit1= remove empty directory: rmdir bit1= remove empty directory: rmdir
bit2= recursion: do not reassure in mode 2 "tree" bit2= recursion: do not reassure in mode 2 "tree"
bit3= this is for overwriting and not for plain removal bit3= this is for overwriting and not for plain removal
bit4= count deleted files in xorriso->pacifier_count
bit5= with bit0 only remove directory content, not the directory
bit6= do not delete eventually existing node from di_array
@return <=0 = error @return <=0 = error
1 = removed simple node 1 = removed simple node
2 = removed directory or tree 2 = removed directory or tree
@ -120,6 +123,7 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag);
int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem, int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem,
char *path, int flag); char *path, int flag);
/* @param flag bit0= long format /* @param flag bit0= long format
bit1= do not print count of nodes bit1= do not print count of nodes
bit2= du format bit2= du format