You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
If you decided to move nobuild.c after bootstrapping, the nobuild executable crashes. That sounds good, however the problem arises if you want to use this function to implement make like behaviour, where only modified files are recompiled.
I think the panic should be limited to the GO_REBUILD_URSELF macro, while the is_path1_modified_after_path2 function should be safe.
Here is my patch for it.
diff --git a/nobuild.h b/nobuild.h
index 1f41c42..6edf869 100644
--- a/nobuild.h+++ b/nobuild.h@@ -242,6 +242,17 @@ void chain_echo(Chain chain);
assert(argc >= 1); \
const char *binary_path = argv[0]; \
\
+ if (!PATH_EXISTS(source_path)) { \+ ERRO("Missing source file '%s', can't Rebuild.\n", \+ source_path); \+ break; \+ } \+ \+ if (!PATH_EXISTS(binary_path)) { \+ ERRO("Missing binary file '%s', How???\n", binary_path); \+ break; \+ } \+ \
if (is_path1_modified_after_path2(source_path, binary_path)) { \
RENAME(binary_path, CONCAT(binary_path, ".old")); \
REBUILD_URSELF(binary_path, source_path); \
@@ -1066,6 +1077,16 @@ void path_rm(Cstr path)
int is_path1_modified_after_path2(const char *path1, const char *path2)
{
+ // Warn the user that the path is missing+ if (!PATH_EXISTS(path1)) {+ WARN("file %s does not exist", path2);+ return 0;+ }++ if (!PATH_EXISTS(path2)) {+ return 1;+ }+
#ifdef _WIN32
FILETIME path1_time, path2_time;
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you decided to move
nobuild.c
after bootstrapping, the nobuild executable crashes. That sounds good, however the problem arises if you want to use this function to implementmake
like behaviour, where only modified files are recompiled.I think the panic should be limited to the
GO_REBUILD_URSELF
macro, while theis_path1_modified_after_path2
function should be safe.Here is my patch for it.
The text was updated successfully, but these errors were encountered: