{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/22745","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/22745/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/22745/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/22745/events","html_url":"https://github.com/nodejs/node/issues/22745","id":358036465,"node_id":"MDU6SXNzdWUzNTgwMzY0NjU=","number":22745,"title":"Please respect FHS on unix","user":{"login":"bastien-roucaries","id":4839964,"node_id":"MDQ6VXNlcjQ4Mzk5NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4839964?v=4","gravatar_id":"","url":"https://api.github.com/users/bastien-roucaries","html_url":"https://github.com/bastien-roucaries","followers_url":"https://api.github.com/users/bastien-roucaries/followers","following_url":"https://api.github.com/users/bastien-roucaries/following{/other_user}","gists_url":"https://api.github.com/users/bastien-roucaries/gists{/gist_id}","starred_url":"https://api.github.com/users/bastien-roucaries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastien-roucaries/subscriptions","organizations_url":"https://api.github.com/users/bastien-roucaries/orgs","repos_url":"https://api.github.com/users/bastien-roucaries/repos","events_url":"https://api.github.com/users/bastien-roucaries/events{/privacy}","received_events_url":"https://api.github.com/users/bastien-roucaries/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-07T11:50:40Z","updated_at":"2018-09-07T11:54:45Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI fill this bug with my debian developer hat and member of the js team. Actually the search path of module are not configurable at build time and it is hard for distro to separate binary module and js only module.\r\n\r\nMoreover actual system does not allow to install i386 and amd64 nodejs on the same machine.\r\n\r\nBinary module should be installed under /usr/lib/arch_triplet/nodejs whereas js only should be installed under /usr/share/nodejs.\r\n\r\nWe plan to commit the following patch that allows to search in more path (and search also on /usr/local/lib like perl).\r\n\r\nCould you commit it ?\r\n\r\n[patch.txt](https://github.com/nodejs/node/files/2360916/patch.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/419416529","html_url":"https://github.com/nodejs/node/issues/22745#issuecomment-419416529","issue_url":"https://api.github.com/repos/nodejs/node/issues/22745","id":419416529,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTQxNjUyOQ==","user":{"login":"bastien-roucaries","id":4839964,"node_id":"MDQ6VXNlcjQ4Mzk5NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4839964?v=4","gravatar_id":"","url":"https://api.github.com/users/bastien-roucaries","html_url":"https://github.com/bastien-roucaries","followers_url":"https://api.github.com/users/bastien-roucaries/followers","following_url":"https://api.github.com/users/bastien-roucaries/following{/other_user}","gists_url":"https://api.github.com/users/bastien-roucaries/gists{/gist_id}","starred_url":"https://api.github.com/users/bastien-roucaries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastien-roucaries/subscriptions","organizations_url":"https://api.github.com/users/bastien-roucaries/orgs","repos_url":"https://api.github.com/users/bastien-roucaries/repos","events_url":"https://api.github.com/users/bastien-roucaries/events{/privacy}","received_events_url":"https://api.github.com/users/bastien-roucaries/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T11:54:45Z","updated_at":"2018-09-07T11:54:45Z","author_association":"NONE","body":"Here inline:\r\n```\r\ndiff --git a/debian/patches/2001_FHS_and_rename_to_nodejs.patch b/debian/patches/2001_FHS_and_rename_to_nodejs.patch\r\nindex 05747742..d190ebea 100644\r\n--- a/debian/patches/2001_FHS_and_rename_to_nodejs.patch\r\n+++ b/debian/patches/2001_FHS_and_rename_to_nodejs.patch\r\n@@ -19,14 +19,3 @@ Last-Update: 2013-03-16\r\n    fs.mkdirSync(prefixLibNodePath);\r\n    const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`);\r\n    fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`);\r\n---- a/lib/internal/modules/cjs/loader.js\r\n-+++ b/lib/internal/modules/cjs/loader.js\r\n-@@ -768,7 +768,7 @@\r\n-   } else {\r\n-     prefixDir = path.resolve(process.execPath, '..', '..');\r\n-   }\r\n--  var paths = [path.resolve(prefixDir, 'lib', 'node')];\r\n-+  var paths = [path.resolve(prefixDir, 'lib', 'nodejs')];\r\n- \r\n-   if (homeDir) {\r\n-     paths.unshift(path.resolve(homeDir, '.node_libraries'));\r\ndiff --git a/debian/patches/build-doc-using-js-yaml.patch b/debian/patches/build-doc-using-js-yaml.patch\r\nindex 2095325d..9204588b 100644\r\n--- a/debian/patches/build-doc-using-js-yaml.patch\r\n+++ b/debian/patches/build-doc-using-js-yaml.patch\r\n@@ -2,9 +2,11 @@ Description: build doc using js-yaml debian package\r\n Forwarded: not-needed\r\n Last-Update: 2018-03-15\r\n Author: Jérémy Lal <kapouer@melix.org>\r\n---- a/Makefile\r\n-+++ b/Makefile\r\n-@@ -618,7 +618,10 @@\r\n+Index: nodejs/Makefile\r\n+===================================================================\r\n+--- nodejs.orig/Makefile\r\n++++ nodejs/Makefile\r\n+@@ -618,7 +618,10 @@ out/doc:\r\n  # Just copy everything under doc/api over.\r\n  out/doc/api: doc/api\r\n  \tmkdir -p $@\r\ndiff --git a/debian/patches/global_path.diff b/debian/patches/global_path.diff\r\nnew file mode 100644\r\nindex 00000000..78ebd1e3\r\n--- /dev/null\r\n+++ b/debian/patches/global_path.diff\r\n@@ -0,0 +1,77 @@\r\n+Index: nodejs/configure\r\n+===================================================================\r\n+--- nodejs.orig/configure\r\n++++ nodejs/configure\r\n+@@ -92,6 +92,11 @@ parser.add_option('--prefix',\r\n+     default='/usr/local',\r\n+     help='select the install prefix [default: %default]')\r\n+ \r\n++parser.add_option('--arch-triplet',\r\n++    action='store',\r\n++    dest='arch_triplet',\r\n++    help='arch tiplet used by distro')\r\n++\r\n+ parser.add_option('--coverage',\r\n+     action='store_true',\r\n+     dest='coverage',\r\n+@@ -130,6 +135,12 @@ parser.add_option('--gdb',\r\n+     dest='gdb',\r\n+     help='add gdb support')\r\n+ \r\n++\r\n++parser.add_option('--global-node-path',\r\n++    action='store',\r\n++    dest='global_node_path',\r\n++    help='Global node path used by require')\r\n++\r\n+ parser.add_option('--no-ifaddrs',\r\n+     action='store_true',\r\n+     dest='no_ifaddrs',\r\n+@@ -1002,6 +1013,16 @@ def configure_node(o):\r\n+   else:\r\n+     o['variables']['node_target_type'] = 'executable'\r\n+ \r\n++  if options.arch_triplet:\r\n++    o['variables']['arch_triplet'] = options.arch_triplet\r\n++  else:\r\n++    o['variables']['arch_triplet'] = 'unknown-unknown-unknown'\r\n++\r\n++  if options.global_node_path:\r\n++    o['variables']['global_node_path'] = options.global_node_path\r\n++  else:\r\n++    o['variables']['global_node_path']= ''\r\n++\r\n+ def configure_library(lib, output):\r\n+   shared_lib = 'shared_' + lib\r\n+   output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))\r\n+Index: nodejs/lib/internal/modules/cjs/loader.js\r\n+===================================================================\r\n+--- nodejs.orig/lib/internal/modules/cjs/loader.js\r\n++++ nodejs/lib/internal/modules/cjs/loader.js\r\n+@@ -43,6 +43,8 @@ const preserveSymlinks = !!process.bindi\r\n+ const preserveSymlinksMain = !!process.binding('config').preserveSymlinksMain;\r\n+ const experimentalModules = !!process.binding('config').experimentalModules;\r\n+ \r\n++const GLOBAL_NODE_PATH = require(\"process\").config.variables.global_node_path;\r\n++\r\n+ const {\r\n+   ERR_INVALID_ARG_TYPE,\r\n+   ERR_INVALID_ARG_VALUE,\r\n+@@ -768,7 +770,16 @@ Module._initPaths = function() {\r\n+   } else {\r\n+     prefixDir = path.resolve(process.execPath, '..', '..');\r\n+   }\r\n+-  var paths = [path.resolve(prefixDir, 'lib', 'node')];\r\n++  var paths = [];\r\n++\r\n++  if (GLOBAL_NODE_PATH) {\r\n++     paths = GLOBAL_NODE_PATH.split(path.delimiter).filter(function pathsFilterCB(path) {\r\n++        return !!path;\r\n++    }).concat(paths);\r\n++  }\r\n++  else {\r\n++    paths.push(path.resolve('/usr','lib','nodejs'));\r\n++  }\r\n+ \r\n+   if (homeDir) {\r\n+     paths.unshift(path.resolve(homeDir, '.node_libraries'));\r\ndiff --git a/debian/patches/series b/debian/patches/series\r\nindex cd794b90..99948b2a 100644\r\n--- a/debian/patches/series\r\n+++ b/debian/patches/series\r\n@@ -1,8 +1,8 @@\r\n+global_path.diff\r\n s_client_tls12.patch\r\n use_system_node_gyp.patch\r\n privacy_breach.patch\r\n build-doc-using-js-yaml.patch\r\n-2001_FHS_and_rename_to_nodejs.patch\r\n 1005_restore_sh_javascript_nonminified.patch\r\n 2017_mips_configure_fpu.patch\r\n test_ci_buildd.patch\r\ndiff --git a/debian/rules b/debian/rules\r\nindex a9014f81..1e7eaa7d 100755\r\n--- a/debian/rules\r\n+++ b/debian/rules\r\n@@ -77,6 +77,8 @@ DEB_CONFIGURE_EXTRA_FLAGS = \\\r\n --with-intl=system-icu \\\r\n --prefix=/usr \\\r\n --openssl-use-def-ca-store \\\r\n+--arch-triplet=$(DEB_HOST_MULTIARCH) \\\r\n+--global-node-path=\"/usr/local/lib/$(DEB_HOST_MULTIARCH)/nodejs:/usr/local/share/nodejs:/usr/local/lib/nodejs:/usr/lib/$(DEB_HOST_MULTIARCH)/nodejs:/usr/share/nodejs:/usr/lib/nodejs\"\r\n #--shared-libuv \\\r\n \r\n # map HOST ARCH AND OS, and if unknown let upstream guess\r\n```"}}
{"actor":{"display_login":"bastien-roucaries"}}