[libcxx-commits] [PATCH] D112086: [libc++][AIX] Do not assert chmod return value is non-zero.

Sean Fertile via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 19 11:04:41 PDT 2021


sfertile created this revision.
sfertile added reviewers: ldionne, daltenty.
sfertile requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

A number of the filesystem tests create a directory that contains a bad symlink. On AIX recursively setting permissions on said directory will return a non-zero value because of the bad symlink, however the following `rm -r` still completes successfully. Avoid the assertion on AIX, and rely on the return value of the remove command to detect problems.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112086

Files:
  libcxx/test/support/filesystem_test_helper.h


Index: libcxx/test/support/filesystem_test_helper.h
===================================================================
--- libcxx/test/support/filesystem_test_helper.h
+++ libcxx/test/support/filesystem_test_helper.h
@@ -141,7 +141,13 @@
 #else
         std::string cmd = "chmod -R 777 " + test_root.string();
         int ret = std::system(cmd.c_str());
+#if !defined(_AIX)
+	// On AIX the chmod command will return non-zero when trying to set
+	// the permissions on a directory that contains a bad symlink. This triggers
+	// the assert, despite being able to delete everything with the following
+	// `rm -r` command.
         assert(ret == 0);
+#endif
 
         cmd = "rm -r " + test_root.string();
         ret = std::system(cmd.c_str());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112086.380733.patch
Type: text/x-patch
Size: 747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211019/2e3b4e51/attachment.bin>


More information about the libcxx-commits mailing list