File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,26 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
105
105
106
106
PackageConfig package_config{};
107
107
package_config.file_path = path;
108
+
109
+ #ifdef _AIX
110
+ // On AIX, the file read can still succeed even if it's a directory.
111
+ // For backporting https://github.com/nodejs/node/pull/50322 to v20.x,
112
+ // add the special case back and return early to notify the JS land
113
+ // and let it treat it as if the package.json does not exist.
114
+ // See https://github.com/libuv/libuv/pull/2025 and
115
+ // https://github.com/nodejs/node/pull/48477#issuecomment-1604586650
116
+ uv_fs_t req;
117
+ int rc = uv_fs_stat (nullptr , &req, path.data (), nullptr );
118
+ if (rc == 0 ) {
119
+ const uv_stat_t * const s = static_cast <const uv_stat_t *>(req.ptr );
120
+ bool is_dir = ((s->st_mode & S_IFMT) == S_IFDIR);
121
+ uv_fs_req_cleanup (&req);
122
+ if (is_dir) {
123
+ return nullptr ;
124
+ }
125
+ }
126
+ #endif
127
+
108
128
// No need to exclude BOM since simdjson will skip it.
109
129
if (ReadFileSync (&package_config.raw_json , path.data ()) < 0 ) {
110
130
return nullptr ;
You can’t perform that action at this time.
0 commit comments