Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
88830da9
Commit
88830da9
authored
16 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
svn merge -r14419:14426
https://eris.llnl.gov/svn/slurm/branches/slurm-1.2
parent
7acff658
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS
+2
-0
2 additions, 0 deletions
NEWS
src/common/env.c
+51
-2
51 additions, 2 deletions
src/common/env.c
with
53 additions
and
2 deletions
NEWS
+
2
−
0
View file @
88830da9
...
...
@@ -382,6 +382,8 @@ documents those changes that are of interest to users and admins.
-- Log to job's output when it is cancelled or reaches it's time limit (ported
from existing code in slurm v1.3).
-- Add support in salloc and sbatch commands for --network option.
-- Add support for user environment variables that include '\n' (e.g.
bash functions).
* Changes in SLURM 1.2.31
=========================
...
...
This diff is collapsed.
Click to expand it.
src/common/env.c
+
51
−
2
View file @
88830da9
...
...
@@ -1254,6 +1254,23 @@ static void _strip_cr_nl(char *line)
}
}
/* Return the net count of curly brackets in a string
* '{' adds one and '}' subtracts one (zero means it is balanced).
* Special case: return -1 if no open brackets are found */
static
int
_bracket_cnt
(
char
*
value
)
{
int
open_br
=
0
,
close_br
=
0
,
i
;
for
(
i
=
0
;
value
[
i
];
i
++
)
{
if
(
value
[
i
]
==
'{'
)
open_br
++
;
else
if
(
value
[
i
]
==
'}'
)
close_br
++
;
}
if
(
open_br
==
0
)
return
-
1
;
return
(
open_br
-
close_br
);
}
/*
* Load user environment from a cache file located in
* <state_save_location>/env_username
...
...
@@ -1290,8 +1307,24 @@ static char **_load_env_cache(const char *username)
_strip_cr_nl
(
line
);
if
(
_env_array_entry_splitter
(
line
,
name
,
sizeof
(
name
),
value
,
ENV_BUFSIZE
)
&&
(
!
_discard_env
(
name
,
value
)))
(
!
_discard_env
(
name
,
value
)))
{
if
(
value
[
0
]
==
'('
)
{
/* This is a bash function.
* It may span multiple lines */
int
bracket_cnt
;
while
((
bracket_cnt
=
_bracket_cnt
(
value
)))
{
if
(
!
fgets
(
line
,
ENV_BUFSIZE
,
fp
))
break
;
_strip_cr_nl
(
line
);
if
((
strlen
(
value
)
+
strlen
(
line
))
>
(
sizeof
(
value
)
-
1
))
break
;
strcat
(
value
,
"
\n
"
);
strcat
(
value
,
line
);
}
}
env_array_overwrite
(
&
env
,
name
,
value
);
}
}
xfree
(
line
);
xfree
(
value
);
...
...
@@ -1499,8 +1532,24 @@ char **env_array_user_default(const char *username, int timeout, int mode)
}
if
(
_env_array_entry_splitter
(
line
,
name
,
sizeof
(
name
),
value
,
ENV_BUFSIZE
)
&&
(
!
_discard_env
(
name
,
value
)))
(
!
_discard_env
(
name
,
value
)))
{
if
(
value
[
0
]
==
'('
)
{
/* This is a bash function.
* It may span multiple lines */
int
bracket_cnt
;
while
((
bracket_cnt
=
_bracket_cnt
(
value
)))
{
line
=
strtok_r
(
NULL
,
"
\n
"
,
&
last
);
if
(
!
line
)
break
;
if
((
strlen
(
value
)
+
strlen
(
line
))
>
(
sizeof
(
value
)
-
1
))
break
;
strcat
(
value
,
"
\n
"
);
strcat
(
value
,
line
);
}
}
env_array_overwrite
(
&
env
,
name
,
value
);
}
line
=
strtok_r
(
NULL
,
"
\n
"
,
&
last
);
}
xfree
(
value
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment