{"thread":{"id":"58995","subject":"[PATCH] mingw: check that the file attributes are valid","startedAt":"2022-12-22T20:22:37Z","lastAt":"2024-12-18T00:37:12Z","messageCount":4,"participants":["Rose via GitGitGadget","AreaZR via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"469479","messageId":"pull.1413.git.git.1671740551466.gitgitgadget@gmail.com","threadId":"58995","inReplyTo":null,"subject":"[PATCH] mingw: check that the file attributes are valid","fromName":"Rose via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-22T20:22:31Z","receivedAt":"2022-12-22T20:22:37Z","isPatch":true,"sender":{"key":"ckelsch@jgrcpa.com","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nIf the attributes are invalid, return an error.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    mingw: check that the file attributes are valid\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAtariDreams%2Fset-hidden-flag-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AtariDreams/set-hidden-flag-v1\nPull-Request: https://github.com/git/git/pull/1413\n\n compat/mingw.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex d614f156df1..71a039cdd7c 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -435,6 +435,11 @@ static inline int needs_hiding(const char *path)\n static int set_hidden_flag(const wchar_t *path, int set)\n {\n \tDWORD original = GetFileAttributesW(path), modified;\n+\tif (original == INVALID_FILE_ATTRIBUTES) {\n+\t\terrno = err_win_to_posix(GetLastError());\n+\t\treturn -1;\n+\t}\n+\n \tif (set)\n \t\tmodified = original | FILE_ATTRIBUTE_HIDDEN;\n \telse\n\nbase-commit: 7c2ef319c52c4997256f5807564523dfd4acdfc7\n-- \ngitgitgadget\n"},{"id":"469916","messageId":"pull.1413.v2.git.git.1673189172832.gitgitgadget@gmail.com","threadId":"58995","inReplyTo":"pull.1413.git.git.1671740551466.gitgitgadget@gmail.com","subject":"[PATCH v2] mingw: check that the file attributes are valid","fromName":"Rose via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-08T14:46:12Z","receivedAt":"2023-01-08T14:46:18Z","isPatch":true,"sender":{"key":"ckelsch@jgrcpa.com","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nIf the attributes are invalid, return -1\nto indicate an error.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    mingw: check that the file attributes are valid\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAtariDreams%2Fset-hidden-flag-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AtariDreams/set-hidden-flag-v2\nPull-Request: https://github.com/git/git/pull/1413\n\nRange-diff vs v1:\n\n 1:  d2992745f3f ! 1:  f1cc7d9a98b mingw: check that the file attributes are valid\n     @@ Metadata\n       ## Commit message ##\n          mingw: check that the file attributes are valid\n      \n     -    If the attributes are invalid, return an error.\n     +    If the attributes are invalid, return -1\n     +    to indicate an error.\n      \n          Signed-off-by: Seija Kijin <doremylover123@gmail.com>\n      \n\n\n compat/mingw.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex af397e68a1d..01bafa01e92 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -435,6 +435,11 @@ static inline int needs_hiding(const char *path)\n static int set_hidden_flag(const wchar_t *path, int set)\n {\n \tDWORD original = GetFileAttributesW(path), modified;\n+\tif (original == INVALID_FILE_ATTRIBUTES) {\n+\t\terrno = err_win_to_posix(GetLastError());\n+\t\treturn -1;\n+\t}\n+\n \tif (set)\n \t\tmodified = original | FILE_ATTRIBUTE_HIDDEN;\n \telse\n\nbase-commit: a38d39a4c50d1275833aba54c4dbdfce9e2e9ca1\n-- \ngitgitgadget\n"},{"id":"469917","messageId":"pull.1413.v3.git.git.1673189354738.gitgitgadget@gmail.com","threadId":"58995","inReplyTo":"pull.1413.v2.git.git.1673189172832.gitgitgadget@gmail.com","subject":"[PATCH v3] mingw: check that the file attributes are valid before modifying them","fromName":"Rose via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-08T14:49:14Z","receivedAt":"2023-01-08T14:49:25Z","isPatch":true,"sender":{"key":"ckelsch@jgrcpa.com","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nIf the attributes are invalid, return -1\nto indicate an error.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    mingw: check that the file attributes are valid before modifying them\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAtariDreams%2Fset-hidden-flag-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AtariDreams/set-hidden-flag-v3\nPull-Request: https://github.com/git/git/pull/1413\n\nRange-diff vs v2:\n\n 1:  f1cc7d9a98b ! 1:  0cbe8bce617 mingw: check that the file attributes are valid\n     @@ Metadata\n      Author: Seija Kijin <doremylover123@gmail.com>\n      \n       ## Commit message ##\n     -    mingw: check that the file attributes are valid\n     +    mingw: check that the file attributes are valid before modifying them\n      \n          If the attributes are invalid, return -1\n          to indicate an error.\n\n\n compat/mingw.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex af397e68a1d..01bafa01e92 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -435,6 +435,11 @@ static inline int needs_hiding(const char *path)\n static int set_hidden_flag(const wchar_t *path, int set)\n {\n \tDWORD original = GetFileAttributesW(path), modified;\n+\tif (original == INVALID_FILE_ATTRIBUTES) {\n+\t\terrno = err_win_to_posix(GetLastError());\n+\t\treturn -1;\n+\t}\n+\n \tif (set)\n \t\tmodified = original | FILE_ATTRIBUTE_HIDDEN;\n \telse\n\nbase-commit: a38d39a4c50d1275833aba54c4dbdfce9e2e9ca1\n-- \ngitgitgadget\n"},{"id":"509251","messageId":"pull.1413.v4.git.git.1734482229018.gitgitgadget@gmail.com","threadId":"58995","inReplyTo":"pull.1413.v3.git.git.1673189354738.gitgitgadget@gmail.com","subject":"[PATCH v4] mingw: check that the file attributes are valid before modifying them","fromName":"AreaZR via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-12-18T00:37:08Z","receivedAt":"2024-12-18T00:37:12Z","isPatch":true,"sender":{"key":"name:AreaZR","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nIf the attributes are invalid, return -1\nto indicate an error.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    mingw: check that the file attributes are valid before modifying them\n    \n    Thanks for taking the time to contribute to Git! Please be advised that\n    the Git community does not use github.com for their contributions.\n    Instead, we use a mailing list (git@vger.kernel.org) for code\n    submissions, code reviews, and bug reports. Nevertheless, you can use\n    GitGitGadget (https://gitgitgadget.github.io/) to conveniently send your\n    Pull Requests commits to our mailing list.\n    \n    Please read the \"guidelines for contributing\" linked above!\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAreaZR%2Fset-hidden-flag-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AreaZR/set-hidden-flag-v4\nPull-Request: https://github.com/git/git/pull/1413\n\nRange-diff vs v3:\n\n 1:  0cbe8bce617 = 1:  0fed7ade880 mingw: check that the file attributes are valid before modifying them\n\n\n compat/mingw.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 63f36c893bf..7f52a4362fe 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -446,6 +446,11 @@ static inline int needs_hiding(const char *path)\n static int set_hidden_flag(const wchar_t *path, int set)\n {\n \tDWORD original = GetFileAttributesW(path), modified;\n+\tif (original == INVALID_FILE_ATTRIBUTES) {\n+\t\terrno = err_win_to_posix(GetLastError());\n+\t\treturn -1;\n+\t}\n+\n \tif (set)\n \t\tmodified = original | FILE_ATTRIBUTE_HIDDEN;\n \telse\n\nbase-commit: 063bcebf0c917140ca0e705cbe0fdea127e90086\n-- \ngitgitgadget\n"}]}