Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ The value is set in job.c.
*/
extern const char *default_shell;

char *remote_description = 0;

/* Remember the original value of the SHELL variable, from the environment. */
struct variable shell_var;

Expand Down
23 changes: 10 additions & 13 deletions src/remote-cstms.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Please do not send bug reports or questions about it to
the Make maintainers.

Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
This file is part of GNU Make.

GNU Make is free software; you can redistribute it and/or modify it under the
Expand All @@ -16,15 +16,18 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */

#include "makeint.h"

#include "filedef.h"
#include "commands.h"
#include "job.h"
#include "commands.h"
#include "debug.h"

#include <sys/time.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <netdb.h>

#include "customs.h"
Expand Down Expand Up @@ -74,19 +77,12 @@ start_remote_job_p (int first_p)
return 0;
}

/* For secure Customs, make is installed setuid root and
Customs requires a privileged source port be used. */
make_access ();

if (ISDB (DB_JOBS))
Rpc_Debug (1);

/* Ping the daemon once to see if it is there. */
inited = Customs_Ping () == RPC_SUCCESS ? 1 : -1;

/* Return to normal user access. */
user_access ();

if (starting_directory == 0)
/* main couldn't figure it out. */
inited = -1;
Expand Down Expand Up @@ -172,7 +168,7 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
len = Customs_MakeWayBill (&permit, normalized_cwd, argv[0], argv,
envp, retport, waybill);

/* Modify the waybill as if the remote child had done 'child_access ()'. */
/* Modify the waybill for the child's uid/gid. */
{
WayBill *wb = (WayBill *) waybill;
wb->ruid = wb->euid;
Expand Down Expand Up @@ -232,7 +228,8 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
else if (pid == 0)
{
/* Child side. Run 'export' to handle the connection. */
static char sock_buf[20], retsock_buf[20], id_buf[20];
static char sock_buf[INTSTR_LENGTH], retsock_buf[INTSTR_LENGTH];
static char id_buf[INTSTR_LENGTH];
static char *new_argv[6] =
{ EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 };

Expand Down
6 changes: 4 additions & 2 deletions src/remote-stub.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Template for the remote job exportation interface to GNU Make.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
This file is part of GNU Make.

GNU Make is free software; you can redistribute it and/or modify it under the
Expand All @@ -12,14 +12,16 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */

#include "makeint.h"
#include "filedef.h"
#include "job.h"
#include "commands.h"


char *remote_description = 0;

/* Call once at startup even if no commands are run. */

void
Expand Down
57 changes: 57 additions & 0 deletions src/rule.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,63 @@ struct file *suffix_file;
/* Maximum length of a suffix. */

static size_t maxsuffix;

/* Return the rule definition: space separated rule targets, followed by
either a colon or two colons in the case of a terminal rule, followed by
space separated rule prerequisites, followed by a pipe, followed by
order-only prerequisites, if present. */

const char *
get_rule_defn (struct rule *r)
{
if (r->_defn == NULL)
{
size_t len = 8; /* Reserve for ":: ", " | ", and nul. */
unsigned int k;
char *p;
const char *sep = "";
const struct dep *dep, *ood = 0;

for (k = 0; k < r->num; ++k)
len += r->lens[k] + 1;

for (dep = r->deps; dep; dep = dep->next)
len += strlen (dep_name (dep)) + (dep->wait_here ? CSTRLEN (" .WAIT") : 0) + 1;

p = r->_defn = xmalloc (len);
for (k = 0; k < r->num; ++k, sep = " ")
p = mempcpy (mempcpy (p, sep, strlen (sep)), r->targets[k], r->lens[k]);
*p++ = ':';
if (r->terminal)
*p++ = ':';

/* Copy all normal dependencies; note any order-only deps. */
for (dep = r->deps; dep; dep = dep->next)
if (dep->ignore_mtime == 0)
{
if (dep->wait_here)
p = mempcpy (p, " .WAIT", CSTRLEN (" .WAIT"));
p = mempcpy (mempcpy (p, " ", 1), dep_name (dep),
strlen (dep_name (dep)));
}
else if (ood == 0)
ood = dep;

/* Copy order-only deps, if we have any. */
for (sep = " | "; ood; ood = ood->next, sep = " ")
if (ood->ignore_mtime)
{
p = mempcpy (p, sep, strlen (sep));
if (ood->wait_here)
p = mempcpy (p, ".WAIT ", CSTRLEN (".WAIT "));
p = mempcpy (p, dep_name (ood), strlen (dep_name (ood)));
}
*p = '\0';
}

return r->_defn;
}


/* Compute the maximum dependency length and maximum number of dependencies of
all implicit rules. Also sets the subdir flag for a rule when appropriate,
Expand Down
6 changes: 4 additions & 2 deletions src/rule.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Definitions for using pattern rules in GNU Make.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
This file is part of GNU Make.

GNU Make is free software; you can redistribute it and/or modify it under the
Expand All @@ -12,7 +12,7 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */


/* Structure used for pattern (implicit) rules. */
Expand All @@ -30,6 +30,7 @@ struct rule
const char **suffixes; /* Suffixes (after '%') of each target. */
struct dep *deps; /* Dependencies of the rule. */
struct commands *cmds; /* Commands to execute. */
char *_defn; /* Definition of the rule. */
unsigned short num; /* Number of targets. */
char terminal; /* If terminal (double-colon). */
char in_use; /* If in use by a parent pattern_search. */
Expand Down Expand Up @@ -64,6 +65,7 @@ void create_pattern_rule (const char **targets, const char **target_percents,

/*! Show information about a given rule. Useful from the debugger or gdb. */
extern void print_rule (rule_t *r, bool b_verbose);
const char *get_rule_defn (struct rule *rule);
extern void print_rule_data_base (bool b_verbose);

#endif /*REMAKE_RULE_H*/