"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/parse_exec.c" between
libisoburn-1.5.0.tar.gz and libisoburn-1.5.2.tar.gz

About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.

parse_exec.c  (libisoburn-1.5.0):parse_exec.c  (libisoburn-1.5.2)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains the implementation of functions which deal with parsing This file contains the implementation of functions which deal with parsing
and interpretation of command input. and interpretation of command input.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 96 skipping to change at line 96
{ {
int i, do_expand, nump, was_empty= 0, filec= 0, ret; int i, do_expand, nump, was_empty= 0, filec= 0, ret;
char **filev= NULL, **patterns= NULL; char **filev= NULL, **patterns= NULL;
off_t mem= 0; off_t mem= 0;
if(flag&2) if(flag&2)
do_expand= (xorriso->do_disk_pattern==1 && !(flag&4)) || (flag & 512); do_expand= (xorriso->do_disk_pattern==1 && !(flag&4)) || (flag & 512);
else else
do_expand= (xorriso->do_iso_rr_pattern==1 && !(flag&4)) || (flag & 512); do_expand= (xorriso->do_iso_rr_pattern==1 && !(flag&4)) || (flag & 512);
if(flag&256) { if(flag&256) {
if(*optv < argv || (*optv >= argv + argc && argc > 0)) if(argv == NULL || *optv < argv || (*optv >= argv + argc && argc > 0))
Sfile_destroy_argv(optc, optv, 0); Sfile_destroy_argv(optc, optv, 0);
return(1); return(1);
} }
if(idx>=argc) { if(idx>=argc) {
*end_idx= argc; *end_idx= argc;
*optc= 0; *optc= 0;
*optv= NULL; *optv= NULL;
sprintf(xorriso->info_text, "%s : Not enough arguments given", cmd); sprintf(xorriso->info_text, "%s : Not enough arguments given", cmd);
if((flag & 128)) if((flag & 128))
return(1); return(1);
skipping to change at line 120 skipping to change at line 120
*end_idx= Xorriso_end_idx(xorriso, argc, argv, idx, *end_idx= Xorriso_end_idx(xorriso, argc, argv, idx,
((flag&1) || do_expand) | (flag&2)); ((flag&1) || do_expand) | (flag&2));
if(*end_idx<0) if(*end_idx<0)
return(*end_idx); return(*end_idx);
if((flag&16) && (*end_idx)>idx) if((flag&16) && (*end_idx)>idx)
(*end_idx)--; (*end_idx)--;
*optc= *end_idx - idx; *optc= *end_idx - idx;
*optv= NULL; *optv= NULL;
if(*optc<=0 || !do_expand) { if(*optc<=0 || !do_expand) {
copy_args:;
if(*optc > 0) { if(*optc > 0) {
Xorriso_alloc_meM(*optv, char *, *optc); Xorriso_alloc_meM(*optv, char *, *optc);
for(i= 0; i < *optc; i++) { for(i= 0; i < *optc; i++) {
Xorriso_alloc_meM((*optv)[i], char, strlen(argv[idx + i]) + 1); Xorriso_alloc_meM((*optv)[i], char, strlen(argv[idx + i]) + 1);
strcpy((*optv)[i], argv[idx + i]); strcpy((*optv)[i], argv[idx + i]);
} }
} }
return(1); return(1);
} }
patterns= calloc(*optc, sizeof(char *)); patterns= calloc(*optc, sizeof(char *));
skipping to change at line 152 skipping to change at line 153
for(i= 0; i<*optc-!!(flag&8); i++) { for(i= 0; i<*optc-!!(flag&8); i++) {
if(argv[i + idx][0]==0) { if(argv[i + idx][0]==0) {
was_empty++; was_empty++;
mem+= sizeof(char *); /* as upper limit for size of an empty string */ mem+= sizeof(char *); /* as upper limit for size of an empty string */
continue; continue;
} }
patterns[nump++]= argv[i + idx]; patterns[nump++]= argv[i + idx];
} }
if(nump<=0) { /* Only empty texts. May the caller get happy with them. */ if(nump<=0) { /* Only empty texts. May the caller get happy with them. */
free(patterns); free(patterns);
return(1); goto copy_args;
} }
if(flag&2) if(flag&2)
ret= Xorriso_expand_disk_pattern(xorriso, nump, patterns, was_empty, ret= Xorriso_expand_disk_pattern(xorriso, nump, patterns, was_empty,
&filec, &filev, &mem, &filec, &filev, &mem,
((flag >> 5) & 3) | ((!!(flag & 1024)) << 3)); ((flag >> 5) & 3) | ((!!(flag & 1024)) << 3));
else else
ret= Xorriso_expand_pattern(xorriso, nump, patterns, was_empty, ret= Xorriso_expand_pattern(xorriso, nump, patterns, was_empty,
&filec, &filev, &mem, &filec, &filev, &mem,
((flag >> 5) & 3) | ((!!(flag & 1024)) << 3)); ((flag >> 5) & 3) | ((!!(flag & 1024)) << 3));
if(ret<=0) if(ret<=0)
skipping to change at line 530 skipping to change at line 531
"" ""
}; };
static char arg1_commands[][40]= { static char arg1_commands[][40]= {
"abort_on","acl","add_plainly","application_id","application_use", "abort_on","acl","add_plainly","application_id","application_use",
"auto_charset","abstract_file", "auto_charset","abstract_file",
"backslash_codes","blank","biblio_file", "backslash_codes","blank","biblio_file",
"calm_drive","cd","cdi","cdx","changes_pending","charset", "calm_drive","cd","cdi","cdx","changes_pending","charset",
"close","close_damaged", "close","close_damaged",
"commit_eject","compliance","copyright_file", "commit_eject","compliance","copyright_file",
"dev","dialog","disk_dev_ino","disk_pattern","displacement", "dev","dialog","disk_dev_ino","disk_pattern","displacement",
"dummy","dvd_obs","early_stdio_test","ecma119_map","eject", "drive_access","dummy","dvd_obs","early_stdio_test","ecma119_map","eject",
"iso_rr_pattern","file_name_limit","follow","format","fs", "iso_nowtime","iso_rr_pattern","file_name_limit","follow","format","fs",
"gid","grow_blindly","hardlinks", "gid","grow_blindly","hardlinks",
"hfsplus","history","indev","in_charset","joliet", "hfsplus","history","indev","in_charset","joliet",
"list_delimiter","list_extras","list_profiles","local_charset", "list_delimiter","list_extras","list_profiles","local_charset",
"mark","md5","mount_opts","modesty_on_drive", "mark","md5","mount_opts","modesty_on_drive",
"not_leaf","not_list","not_mgt", "not_leaf","not_list","not_mgt",
"options_from_file","osirrox","outdev","out_charset","overwrite", "options_from_file","osirrox","outdev","out_charset","overwrite",
"pacifier","padding","path_list","pathspecs","pkt_output", "pacifier","padding","path_list","pathspecs","pkt_output",
"preparer_id","print","print_info","print_mark","prompt", "preparer_id","print","print_info","print_mark","prompt",
"prog","prog_help","publisher","quoted_not_list","quoted_path_list", "prog","prog_help","publisher","quoted_not_list","quoted_path_list",
"read_fs","read_speed","reassure","report_about", "read_fs","read_speed","reassure","report_about",
skipping to change at line 672 skipping to change at line 673
"error_behavior", "error_behavior",
"* Scripting, dialog and program control features (1):", "* Scripting, dialog and program control features (1):",
"no_rc", "help", "version", "list_extras", "list_arg_sorting", "no_rc", "help", "version", "list_extras", "list_arg_sorting",
"temp_mem_limit", "backslash_codes", "temp_mem_limit", "backslash_codes",
"errfile_log", "session_log", "scsi_log", "errfile_log", "session_log", "scsi_log",
"options_from_file", "list_delimiter", "options_from_file", "list_delimiter",
"print", "print_info", "print_mark", "prompt", "sleep", "print", "print_info", "print_mark", "prompt", "sleep",
"sh_style_result", "sh_style_result",
"* Influencing opening of drives:",
"drive_access","drive_class","early_stdio_test",
"* Drive and media related inquiry actions (1):", "* Drive and media related inquiry actions (1):",
"devices", "device_links", "devices", "device_links",
"mount_opts", "mount_cmd", "session_string", "mount_opts", "mount_cmd", "session_string",
"* Influencing the behavior of image loading:", "* Influencing the behavior of image loading:",
"read_speed", "load", "displacement", "read_fs", "read_speed", "load", "displacement", "read_fs",
"drive_class", "assert_volid", "in_charset", "assert_volid", "in_charset",
"auto_charset", "hardlinks", "acl", "xattr", "md5", "for_backup", "auto_charset", "hardlinks", "acl", "xattr", "md5", "for_backup",
"ecma119_map", "ecma119_map",
"disk_dev_ino", "rom_toc_scan", "calm_drive", "ban_stdio_write", "disk_dev_ino", "rom_toc_scan", "calm_drive", "ban_stdio_write",
"early_stdio_test", "data_cache_size", "data_cache_size",
"scsi_dev_family", "scsi_dev_family", "iso_nowtime",
"* Character sets:", "* Character sets:",
"charset", "local_charset", "charset", "local_charset",
"* Acquiring source and target drive:", "* Acquiring source and target drive:",
"dev", "indev", "outdev", "dev", "indev", "outdev",
"* Drive and media related inquiry actions (2):", "* Drive and media related inquiry actions (2):",
"list_profiles", "list_formats", "list_speeds", "list_profiles", "list_formats", "list_speeds",
"toc", "toc_of", "pvd_info", "report_system_area", "report_el_torito", "toc", "toc_of", "pvd_info", "report_system_area", "report_el_torito",
skipping to change at line 1240 skipping to change at line 1244
ret= Xorriso_option_disk_dev_ino(xorriso, arg1, 0); ret= Xorriso_option_disk_dev_ino(xorriso, arg1, 0);
} else if(strcmp(cmd,"displacement")==0) { } else if(strcmp(cmd,"displacement")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_displacement(xorriso, arg1, 0); ret= Xorriso_option_displacement(xorriso, arg1, 0);
} else if(strcmp(cmd,"disk_pattern")==0) { } else if(strcmp(cmd,"disk_pattern")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_disk_pattern(xorriso, arg1, 0); ret= Xorriso_option_disk_pattern(xorriso, arg1, 0);
} else if(strcmp(cmd,"drive_access")==0) {
(*idx)++;
ret= Xorriso_option_drive_access(xorriso, arg1, 0);
} else if(strcmp(cmd,"drive_class")==0) { } else if(strcmp(cmd,"drive_class")==0) {
(*idx)+= 2; (*idx)+= 2;
ret= Xorriso_option_drive_class(xorriso, arg1, arg2, 0); ret= Xorriso_option_drive_class(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"du")==0 || strcmp(cmd,"dui")==0 || } else if(strcmp(cmd,"du")==0 || strcmp(cmd,"dui")==0 ||
strcmp(cmd,"dus")==0 || strcmp(cmd,"dusi")==0) { strcmp(cmd,"dus")==0 || strcmp(cmd,"dusi")==0) {
ret= Xorriso_option_lsi(xorriso, argc, argv, idx, (cmd[2]!='s')|4); ret= Xorriso_option_lsi(xorriso, argc, argv, idx, (cmd[2]!='s')|4);
} else if(strcmp(cmd,"dummy")==0) { } else if(strcmp(cmd,"dummy")==0) {
(*idx)++; (*idx)++;
skipping to change at line 1392 skipping to change at line 1400
ret= Xorriso_option_history(xorriso, arg1, 0); ret= Xorriso_option_history(xorriso, arg1, 0);
} else if(strcmp(cmd,"indev")==0) { } else if(strcmp(cmd,"indev")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_dev(xorriso, arg1, 1); ret= Xorriso_option_dev(xorriso, arg1, 1);
} else if(strcmp(cmd,"in_charset")==0) { } else if(strcmp(cmd,"in_charset")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_charset(xorriso, arg1, 1); ret= Xorriso_option_charset(xorriso, arg1, 1);
} else if(strcmp(cmd,"iso_nowtime")==0) {
(*idx)++;
ret= Xorriso_option_iso_nowtime(xorriso, arg1, 0);
} else if(strcmp(cmd,"iso_rr_pattern")==0) { } else if(strcmp(cmd,"iso_rr_pattern")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0); ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
} else if(strcmp(cmd,"jigdo")==0) { } else if(strcmp(cmd,"jigdo")==0) {
(*idx)+= 2; (*idx)+= 2;
ret= Xorriso_option_jigdo(xorriso, arg1, arg2, 0); ret= Xorriso_option_jigdo(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"joliet")==0) { } else if(strcmp(cmd,"joliet")==0) {
(*idx)++; (*idx)++;
skipping to change at line 2551 skipping to change at line 2563
ex:; ex:;
Xorriso_free_meM(path); Xorriso_free_meM(path);
return(ret); return(ret);
} }
/* https://reproducible-builds.org/specs/source-date-epoch/ /* https://reproducible-builds.org/specs/source-date-epoch/
and reproducible-builds@lists.alioth.debian.org in august 2016 and reproducible-builds@lists.alioth.debian.org in august 2016
*/ */
int Xorriso_source_date_epoch(struct XorrisO *xorriso, int flag) int Xorriso_source_date_epoch(struct XorrisO *xorriso, int flag)
{ {
char *sec_text, double_text[40]; /* num_text must be able to take the sprintf output of "%.f".
num_text + 12 must be able to take "%d" with a 64 bit int.
*/
char *sec_text, num_text[40];
double dsec= -1.0; double dsec= -1.0;
time_t tsec; time_t tsec;
struct tm *gmt; struct tm *gmt;
sec_text= getenv("SOURCE_DATE_EPOCH"); sec_text= getenv("SOURCE_DATE_EPOCH");
if(sec_text == NULL) if(sec_text == NULL)
return(2); return(2);
sscanf(sec_text, "%lf", &dsec); sscanf(sec_text, "%lf", &dsec);
sprintf(double_text, "%.f", dsec); sprintf(num_text, "%.f", dsec);
tsec= dsec; tsec= dsec;
if(dsec < 0 || ((double) tsec) != dsec || if(dsec < 0 || ((double) tsec) != dsec ||
strcmp(sec_text, double_text) != 0) { strcmp(sec_text, num_text) != 0) {
malformed:; malformed:;
Xorriso_msgs_submit(xorriso, 0, Xorriso_msgs_submit(xorriso, 0,
"Malformed environment variable SOURCE_DATE_EPOCH encountered", "Malformed environment variable SOURCE_DATE_EPOCH encountered",
0, "SORRY", 0); 0, "SORRY", 0);
Xorriso_msgs_submit(xorriso, 0, Xorriso_msgs_submit(xorriso, 0,
"Unset SOURCE_DATE_EPOCH before starting xorriso or see https:// reproducible-builds.org/specs/source-date-epoch/", "Unset SOURCE_DATE_EPOCH before starting xorriso or see https:// reproducible-builds.org/specs/source-date-epoch/",
0, "HINT", 0); 0, "HINT", 0);
return(0); return(0);
} }
gmt= gmtime(&tsec); gmt= gmtime(&tsec);
if(gmt == NULL) if(gmt == NULL)
goto malformed; goto malformed;
sprintf(xorriso->vol_uuid, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00",
1900 + gmt->tm_year, gmt->tm_mon + 1, gmt->tm_mday, sprintf(num_text, "%4.4d", 1900 + gmt->tm_year);
gmt->tm_hour, gmt->tm_min, gmt->tm_sec); sprintf(num_text + 4, "%2.2d", gmt->tm_mon + 1);
sprintf(num_text + 6, "%2.2d", gmt->tm_mday);
sprintf(num_text + 8, "%2.2d", gmt->tm_hour);
sprintf(num_text + 10, "%2.2d", gmt->tm_min);
sprintf(num_text + 12, "%2.2d", gmt->tm_sec);
strcpy(num_text + 14, "00");
strcpy(xorriso->vol_uuid, num_text);
xorriso->gpt_guid_mode= 2; /* Disk GUID from vol_uuid */ xorriso->gpt_guid_mode= 2; /* Disk GUID from vol_uuid */
strcpy(xorriso->all_file_dates, "set_to_mtime"); strcpy(xorriso->all_file_dates, "set_to_mtime");
xorriso->do_override_now_time= 1;
xorriso->now_time_override= tsec;
Xorriso_set_libisofs_now(xorriso, 0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Environment variable SOURCE_DATE_EPOCH encountered with value %s", "Environment variable SOURCE_DATE_EPOCH encountered with value %s",
sec_text); sec_text);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
sprintf(xorriso->info_text, "SOURCE_DATE_EPOCH : -volume_date uuid %s", sprintf(xorriso->info_text, "SOURCE_DATE_EPOCH : -volume_date uuid %s",
xorriso->vol_uuid); xorriso->vol_uuid);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"SOURCE_DATE_EPOCH : -volume_date all_file_dates %s", "SOURCE_DATE_EPOCH : -volume_date all_file_dates %s",
xorriso->all_file_dates); xorriso->all_file_dates);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"SOURCE_DATE_EPOCH : -boot_image any volume_date_uuid"); "SOURCE_DATE_EPOCH : -boot_image any gpt_disk_guid=volume_date_uuid");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text,
"SOURCE_DATE_EPOCH : -iso_nowtime =%.f", (double) tsec);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1); return(1);
} }
int Xorriso_read_rc(struct XorrisO *xorriso, int flag) int Xorriso_read_rc(struct XorrisO *xorriso, int flag)
{ {
int ret,i,was_failure= 0,fret; int ret,i,was_failure= 0,fret;
/* Interpret environment variable SOURCE_DATE_EPOCH */ /* Interpret environment variable SOURCE_DATE_EPOCH */
ret= Xorriso_source_date_epoch(xorriso, 0); ret= Xorriso_source_date_epoch(xorriso, 0);
ret= Xorriso_eval_problem_status(xorriso, ret, 0); ret= Xorriso_eval_problem_status(xorriso, ret, 0);
 End of changes. 17 change blocks. 
15 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)