Skip to content

Commit 6be24ed

Browse files
author
ripley
committed
someone might edit an autconf script to use /bin/bash
git-svn-id: https://svn.r-project.org/R/trunk@87497 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent a928176 commit 6be24ed

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

src/library/tools/R/check.R

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,28 @@ add_dummies <- function(dir, Log)
13951395
## checkbashisms skips non-shell scripts, and bash ones with a message.
13961396
if (config_val_to_logical(Sys.getenv("_R_CHECK_BASHISMS_", "FALSE"))
13971397
&& any(file.exists("configure", "cleanup"))) {
1398+
for (f in c("configure", "cleanup")) {
1399+
## /bin/bash is not portable
1400+
if (file.exists(f) &&
1401+
any(grepl("^#! */bin/bash",
1402+
readLines(f, 1L, warn = FALSE)))) {
1403+
if(!any) {
1404+
any <- TRUE
1405+
msg <- paste0(sQuote(f), ": /bin/bash is not portable")
1406+
noteLog(Log, msg)
1407+
}
1408+
}
1409+
## and bash need not be installed at all.
1410+
if (file.exists(f) &&
1411+
any(grepl("^#!.*env bash",
1412+
readLines(f, 1L, warn = FALSE)))) {
1413+
if(!any) {
1414+
any <- TRUE
1415+
msg <- paste0(sQuote(f), ": 'env bash' is not portable as bash need not be installed")
1416+
noteLog(Log, msg)
1417+
}
1418+
}
1419+
}
13981420
if (!nzchar(Sys.which("checkbashisms"))) {
13991421
if(!any) {
14001422
any <- TRUE
@@ -1406,26 +1428,6 @@ add_dummies <- function(dir, Log)
14061428
"in the 'Writing R Extensions' manual.\n")
14071429
} else {
14081430
for (f in c("configure", "cleanup")) {
1409-
## /bin/bash is not portable
1410-
if (file.exists(f) &&
1411-
any(grepl("^#! */bin/bash",
1412-
readLines(f, 1L, warn = FALSE)))) {
1413-
if(!any) {
1414-
any <- TRUE
1415-
msg <- paste0(sQuote(f), ": /bin/bash is not portable")
1416-
noteLog(Log, msg)
1417-
}
1418-
}
1419-
## and bash need not be installed at all.
1420-
if (file.exists(f) &&
1421-
any(grepl("^#!.*env bash",
1422-
readLines(f, 1L, warn = FALSE)))) {
1423-
if(!any) {
1424-
any <- TRUE
1425-
msg <- paste0(sQuote(f), ": 'env bash' is not portable as bash need not be installed")
1426-
noteLog(Log, msg)
1427-
}
1428-
}
14291431
## skip autoconf scripts as checkbashisms warns on system parts
14301432
if (file.exists(f) &&
14311433
!any(grepl("Generated by GNU Autoconf",

0 commit comments

Comments
 (0)