summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-02 23:44:16 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-02 23:44:16 (EDT)
commit2ad8233479d3b29e5b171728e26e735cdaa5f82c (patch)
tree5261b6c78833484be464818a10d6472dec8495b6
parentf9f5d5bdc3de328f0bb89854a4f1c85ab2988bfb (diff)
Detect invalid binary package names.
-rw-r--r--locale/en_US.sh1
-rw-r--r--src/opkbuild.sh4
2 files changed, 5 insertions, 0 deletions
diff --git a/locale/en_US.sh b/locale/en_US.sh
index 49329c5..833a286 100644
--- a/locale/en_US.sh
+++ b/locale/en_US.sh
@@ -99,6 +99,7 @@ oh_str_arch_stat_plat=' Platform: %s'
oh_str_host_arch_stat_header='Host system:'
oh_str_asterisk_binary_package='Clever user found'
oh_str_no_binary_packages='No binary packages found'
+oh_str_bad_binary_package_name='Invalid binary package name "%s"'
oh_str_cant_make_work_area='Can'\''t make work area'
oh_str_cant_enter_work_area='Can'\''t enter work area'
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 832b43c..e1da8e4 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -417,6 +417,10 @@ step_bincontrol()
oh_error "${oh_str_no_binary_packages}"
fi
fi
+ echo "${pkg}" | grep -E "${OH_SOURCE_RE}" >/dev/null 2>&1
+ if [ "${?}" -ne 0 ]; then
+ oh_error "${oh_str_bad_binary_package_name}" "${pkg}"
+ fi
oh_control_parse_binary "${pkg}"
for field in ${OH_CONTROL_BINARY_FIELDS_REQUIRED} \
${OH_CONTROL_BINARY_FIELDS_OPTIONAL}; do