Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update system call for composer #4579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cpp/installer.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** \brief A tool for installing IxTheo and KrimDok from scratch on Ubuntu systems.
* \author Dr. Johannes Ruscheinski ([email protected])
* \author Steven Lolong ([email protected])
*
* \copyright 2016-2021 Universitätsbibliothek Tübingen. All rights reserved.
* \copyright 2016-2024 Universitätsbibliothek Tübingen. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -809,7 +810,8 @@ void ConfigureVuFind(const bool production, const VuFindSystemType vufind_system
Echo("Configuring vufind");
// We need to increase default_socket_timeout for big downloads on slow mirrors, especially Solr (default 60 seconds) .
TemporaryChDir tmp2(VUFIND_DIRECTORY);
ExecUtil::ExecOrDie(ExecUtil::LocateOrDie("php"), { "-d", "default_socket_timeout=600", ExecUtil::LocateOrDie("composer"), "install" });
system("composer install");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple aspects:

  1. The override of default_socket_timeout is removed (that's why we initially called PHP instead of composer directly)
  2. Due to our convention (see ExecUtil) system calls should be called with double colons at the start => ::system()
  3. If it is necessary to use a different system call, then we should create a wrapper function in ExecUtil to do so
  4. You're just calling system() without checking the result => please check the manpage, you must check the result code against -1 and maybe also output a log message containing errno.


// We explicitly need to use sudo here, even if we're already root, or it will fail,
// see https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo
ExecUtil::ExecOrDie(ExecUtil::LocateOrDie("sudo"), { "npm", "install" });
Expand Down