Skip to content

Commit 3b74a9f

Browse files
authored
Merge pull request #1231 from xexyl/1208
Partial fix to issue #1208 Please NOTE: This commit, while recommended, is not mandatory for IOCCC28. Existing submissions under the previously released mkiocccentry toolkit remain valid.
2 parents a0f669d + edd6d61 commit 3b74a9f

File tree

8 files changed

+242
-182
lines changed

8 files changed

+242
-182
lines changed

CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ to true if the UUID was `"true"`.
1111
The `-u uuidfile` and `-U UUID` options may not be used with `-i answers`, `-d`
1212
or `-s seed`.
1313

14+
Partial fix to issue #1208. The `-x` option to force delete the
15+
submission directory and `-r rm` option to set path to `rm(1)` were added to
16+
`mkiocccentry` as part of #1208. The change in order of args is **NOT** done and
17+
will not be done until **AFTER** IOCCC28.
18+
19+
Fixed bug where `overwrite_answers` was always true by default (`mkiocccentry`).
20+
1421
Updated man page for the above changes.
1522

1623
**IMPORTANT NOTE**: you do NOT need to use this update in order to participate

mkiocccentry.c

+205-173
Large diffs are not rendered by default.

mkiocccentry.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static char *prompt(char const *str, size_t *lenp);
184184
static char *get_contest_id(bool *testp, char const *uuidf, char *uuidstr);
185185
static int get_submit_slot(struct info *infop);
186186
static char *mk_submission_dir(char const *workdir, char const *ioccc_id, int submit_slot,
187-
char **tarball_path, time_t tstamp, bool test_mode);
187+
char **tarball_path, time_t tstamp, bool test_mode, bool force_remove,
188+
char const *rm);
188189
static bool inspect_Makefile(char const *Makefile, struct info *infop);
189190
static void warn_Makefile(struct info *infop);
190191
static void check_Makefile(struct info *infop, char const *Makefile);

soup/man/man1/mkiocccentry.1

+14-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ if this option is not specified.
220220
Pass
221221
.B \-e
222222
to
223-
.BR txzchk (1).
223+
.BR txzchk (1)
224+
(entertainment mode).
224225
.TP
225226
.BI \-f\ feathers
226227
Pass
@@ -384,6 +385,18 @@ option.
384385
If the path is a directory
385386
.BR mkiocccentry (1)
386387
will not traverse it.
388+
.TP
389+
.BI \-r\ rm
390+
Set path to
391+
.BR rm (1)
392+
if
393+
.B \-x
394+
used.
395+
.TP
396+
.B \-x
397+
Force delete submission directory if it already exists.
398+
Use with
399+
.BR CARE !
387400
.SH EXIT STATUS
388401
.TP
389402
0

soup/sanity.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,14 @@ ioccc_sanity_chks(void)
102102
* chkentry - if -C chkentry was used and chkentry != NULL set *chkentry to path
103103
* make_flag_used - true ==> -m make was used
104104
* make - if -m make was used and make != NULL set *make to path
105+
* rm_flag_used - true ==> -r rm was used
106+
* rm - if -r rm was used and rm != NULL set *rm to path
105107
*/
106108
void
107109
find_utils(bool tar_flag_used, char **tar, bool ls_flag_used,
108110
char **ls, bool txzchk_flag_used, char **txzchk, bool fnamchk_flag_used, char **fnamchk,
109-
bool chkentry_flag_used, char **chkentry, bool make_flag_used, char **make)
111+
bool chkentry_flag_used, char **chkentry, bool make_flag_used, char **make,
112+
bool rm_flag_used, char **rm)
110113
{
111114
/*
112115
* guess where tar and ls utilities are located
@@ -144,7 +147,10 @@ find_utils(bool tar_flag_used, char **tar, bool ls_flag_used,
144147
*make = MAKE_PATH_1;
145148
dbg(DBG_MED, "using default make path: %s", MAKE_PATH_1);
146149
}
147-
150+
if (rm != NULL && !rm_flag_used && !is_exec(RM_PATH_0) && is_exec(RM_PATH_1)) {
151+
*rm = RM_PATH_1;
152+
dbg(DBG_MED, "using default rm path: %s", RM_PATH_1);
153+
}
148154

149155
return;
150156
}

soup/sanity.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
extern void ioccc_sanity_chks(void); /* all *_sanity_chks() functions should call this */
7676
extern void find_utils(bool tar_flag_used, char **tar, bool ls_flag_used,
7777
char **ls, bool txzchk_flag_used, char **txzchk, bool fnamchk_flag_used, char **fnamchk,
78-
bool chkentry_flag_used, char **chkentry, bool make_flag_used, char **make);
79-
80-
78+
bool chkentry_flag_used, char **chkentry, bool make_flag_used, char **make, bool rm_flag_used,
79+
char **rm);
8180

8281
#endif /* INCLUDE_SANITY_H */

soup/soup.h

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
#define JPARSE_PATH_1 "/usr/local/bin/jparse" /* default path to jparse tool if installed */
117117
#define MAKE_PATH_0 "/usr/bin/make" /* default path to make tool */
118118
#define MAKE_PATH_1 "/bin/make" /* in case /usr/bin/make doesn't work */
119+
#define RM_PATH_0 "/bin/rm" /* default path to rm tool */
120+
#define RM_PATH_1 "/usr/bin/rm" /* in case /bin/rm doesn't work */
119121

120122

121123
/*

txzchk.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ main(int argc, char **argv)
279279

280280
if (!read_from_text_file) {
281281
find_utils(tar_flag_used, &tar, false, NULL, false, NULL,
282-
fnamchk_flag_used, &fnamchk, false, NULL, false, NULL);
282+
fnamchk_flag_used, &fnamchk, false, NULL, false, NULL, false, NULL);
283283
} else {
284284
find_utils(false, NULL, false, NULL, false, NULL,
285-
fnamchk_flag_used, &fnamchk, false, NULL, false, NULL);
285+
fnamchk_flag_used, &fnamchk, false, NULL, false, NULL, false, NULL);
286286
}
287287

288288
/* additional sanity checks */

0 commit comments

Comments
 (0)