Skip to content

Fix and improve warning of -y and -Y #1192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Major changes to the IOCCC entry toolkit


## Release 2.3.45 2025-02-28

Fix and improve warning of `-y` and `-Y` in `mkiocccentry`.

The code did not explicitly check for `-Y`; it just used the implicit `-y` from
`-Y`. That is fixed and now if not `-q` show a simple summary but always show
the longer warning to be sure that they know. As for `-Y` it really ought to be
used only for the test script but even `-y` should be used with **EXTREME**
caution.

It is hoped this is the last update to `mkiocccentry(1)` prior to the soft code
freeze today.

TODO: finish work on the `chkentry_test.sh` script.



## Release 2.3.44 2025-02-27

Prepare for code freeze (28 February 2025) with some final changes, some
Expand Down
55 changes: 34 additions & 21 deletions mkiocccentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,39 +567,52 @@ main(int argc, char *argv[])
print("Welcome to mkiocccentry version: %s\n", MKIOCCCENTRY_VERSION);
}


/*
* warn (if not -q/quiet mode) user that with -i answers (or -y) we will
* always answer yes. This is especially important (in fact absolutely
* essential for -i answers) because if there was a change in file set(s)
* then the answers file would be entirely useless!
* warn about -Y option
*/
if (answer_yes && !quiet) {
if (force_yes) {
para("",
"WARNING: you've chosen to answer YES to ALL prompts. If this was",
"unintentional, run the program again without specifying -Y. We cannot",
"stress the importance of this enough! Well OK, we can overstress most things",
"but you get the point; do not use the -Y option without EXTREME caution!",
"",
"Hint: this option is mostly useful for mkiocccentry_test.sh; if you REALLY",
"want to answer yes you should use -y instead which will allow you to still",
"verify certain things.",
"",
NULL);

/*
* we could use msg() but this performs more checks which is very
* important for this
* if not quiet give a shorter warning as well
*/
print("%s", "Notice: we will always answer yes to questions.");
if (!quiet) {
print("%s", "Notice: we will ALWAYS answer YES to questions.\n");
}
} else if (answer_yes) {
/* warn about -y option */
para("",
"WARNING: you've chosen to answer yes to ALMOST ALL prompts. If this was",
"unintentional, run the program again without specifying -y. We cannot",
"stress the importance of this enough! Well OK, we can overstress most things",
"but you get the point; do not use the -y option without EXTREME caution!",
"",
NULL);
/*
* if not quiet give a shorter warning as well
*/
if (!quiet) {
print("%s", "Notice: we will answer YES to MOST questions.\n");
}
}



/*
* save our version
*/
info.mkiocccentry_ver = MKIOCCCENTRY_VERSION;
dbg(DBG_HIGH, "info.mkiocccentry_ver: %s", info.mkiocccentry_ver);

/* warn about -y option */
if (answer_yes) {
para("",
"WARNING: you've chosen to answer yes to almost all prompts. If this was",
"unintentional, run the program again without specifying -y. We cannot",
"stress the importance of this enough! Well OK, we can overstress most things",
"but you get the point; do not use the -y option without EXTREME caution!",
"",
NULL);
}

/* if the user requested to ignore warnings, and now -E, then ignore this once and warn them :) */
if (ignore_warnings) {
para("",
Expand Down
4 changes: 2 additions & 2 deletions soup/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
*
* NOTE: This should match the latest Release string in CHANGES.md
*/
#define MKIOCCCENTRY_REPO_VERSION "2.3.45 2025-02-27" /* special release format: major.minor[.patch] YYYY-MM-DD */
#define MKIOCCCENTRY_REPO_VERSION "2.3.46 2025-02-28" /* special release format: major.minor[.patch] YYYY-MM-DD */


/*
Expand All @@ -99,7 +99,7 @@
/*
* official mkiocccentry versions (mkiocccentry itself and answers)
*/
#define MKIOCCCENTRY_VERSION "1.2.35 2025-02-27" /* format: major.minor YYYY-MM-DD */
#define MKIOCCCENTRY_VERSION "1.2.36 2025-02-28" /* format: major.minor YYYY-MM-DD */
#define MKIOCCCENTRY_ANSWERS_VERSION "MKIOCCCENTRY_ANSWERS_IOCCC28-1.0" /* answers file version */
#define MKIOCCCENTRY_ANSWERS_EOF "ANSWERS_EOF" /* answers file EOF marker */

Expand Down