node icon indicating copy to clipboard operation
node copied to clipboard

AIX 7.1: unable to make uninstall result from errno EEXIST not ENOTEMPTY or ENOENT

Open cloorc opened this issue 4 months ago • 0 comments

Version

20.18.0

Platform

AIX hostname 1 7 00********00

Subsystem

No response

What steps will reproduce the bug?

  1. Login to AIX and download node-v20.18.0 source code, decompress and enter the folder
  2. Using gcc 11 to build : CC=gcc-11 CXX=g++-11 MAKE=gmake ./configure --prefix=$HOME/local --shared --libdir=$HOME/local
  3. Build node v20.18.0 with : gmake && gmake install
  4. Uninstall the binaries as gmake uninstall

How often does it reproduce? Is there a required condition?

Must appear

What is the expected behavior? Why is that the expected behavior?

Can be uninstalled as expected

What do you see instead?

From tools/install.py, contains following source code:

 26 def try_symlink(options, source_path, link_path):
 27   if not options.silent:
 28     print('symlinking %s -> %s' % (source_path, link_path))
 29   try_unlink(link_path)
 30   try_mkdir_r(os.path.dirname(link_path))
 31   os.symlink(source_path, link_path)
 32
 33 def try_mkdir_r(path):
 34   try:
 35     os.makedirs(path)
 36   except OSError as e:
 37     if e.errno != errno.EEXIST: raise
 38
 39 def try_rmdir_r(options, path):
 40   path = abspath(path)
 41   while is_child_dir(path, options.install_path):
 42     try:
 43       os.rmdir(path)
 44     except OSError as e:
 45       if e.errno == errno.ENOTEMPTY: return
 46       if e.errno == errno.ENOENT: return
 47       raise
 48     path = abspath(path, '..')
 49

As coded in line 45-46, only ENOTEMPTY and ENOENT error will be treated as normal. However, in AIX 7.1, if the target file or folder doesn't exist, the error is EEXIST.

From /usr/include/errno.h in AIX 7.1, we got following comment:

193 /*
194  * AIX returns EEXIST where 4.3BSD used ENOTEMPTY;
195  * but, the standards insist on unique errno values for each errno.
196  * A unique value is reserved for users that want to code case
197  * statements for systems that return either EEXIST or ENOTEMPTY.
198  */

As described in include/uapi/asm-generic/errno-base.h, EEXIST is 17, which is referred by python/cpython.

Additional information

No response

cloorc avatar Oct 18 '24 02:10 cloorc