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

fix basename: illegal option -- b issue with upstream filenames starting with - #17143

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

xiaods
Copy link
Contributor

@xiaods xiaods commented Nov 2, 2017

issue:

$ git branch -vv
* devel  3ea2451f08 Merge pull request #17120 from joelsmith/master
  master 3ae44301f9 [origin/master] fix basename: illegal option -- b issue with upstream filenames starting with -
xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel*
$ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
basename: illegal option -- b
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]

caused by :

The -- (dash dash) stops basename from processing any options in the argument.
Always quote $0 in case there are spaces in the name.

@openshift-ci-robot openshift-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 2, 2017
@xiaods
Copy link
Contributor Author

xiaods commented Nov 2, 2017

sorry for the re-submit pr for confuse. but it do a wrong swap for my repo master branch, it let original pr is removed. so i have to re-pr the patch.

@stevekuznetsov
Copy link
Contributor

Can you please paste your full path so we can determine what part of the thing is being interpreted as a flag. I cannot reproduce this locally unless I create a filename that starts with a -

@xiaods xiaods changed the title fix basename: illegal option -- b issue with upstream filenames start… fix basename: illegal option -- b issue with upstream filenames starting with - Nov 3, 2017
@xiaods
Copy link
Contributor Author

xiaods commented Nov 3, 2017

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G29

i am follow CONTRIBUTING.adoc +140 line

In order to make use of the binaries from your shell, add the build output
directory to the `$PATH`:
----
$ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
----

it raised error above in desc.

@stevekuznetsov
Copy link
Contributor

Could you please paste your full path?

@xiaods
Copy link
Contributor Author

xiaods commented Nov 6, 2017

in my gopath:

xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin

@stevekuznetsov
Copy link
Contributor

Please, your FULL path -- what is ~ expanding to? What file is causing this?

@xiaods
Copy link
Contributor Author

xiaods commented Nov 7, 2017

@stevekuznetsov

xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel*
$ pwd
/Users/xiaods/go/src/github.com/openshift/origin
xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel*
$ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
basename: illegal option -- b
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]

@stevekuznetsov
Copy link
Contributor

@xiaods could you please run:

$ echo PATH="${PATH}:$( set -o xtrace; source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"

@xiaods
Copy link
Contributor Author

xiaods commented Nov 13, 2017

sorry for late response. @stevekuznetsov

$ echo PATH="${PATH}:$( set -o xtrace; source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
++ source hack/lib/init.sh
+++ set -o errexit
+++ set -o nounset
+++ set -o pipefail
++++ date +%s
+++ OS_SCRIPT_START_TIME=1510545332
+++ export OS_SCRIPT_START_TIME
+++ readonly -f os::util::absolute_path
++++ dirname hack/lib/init.sh
+++ init_source=hack/lib/../..
++++ os::util::absolute_path hack/lib/../..
++++ local relative_path=hack/lib/../..
++++ local absolute_path
++++ pushd hack/lib/../..
+++++ pwd
++++ relative_path=/Users/xiaods/go/src/github.com/openshift/origin
++++ [[ -h /Users/xiaods/go/src/github.com/openshift/origin ]]
++++ absolute_path=/Users/xiaods/go/src/github.com/openshift/origin
++++ popd
++++ echo /Users/xiaods/go/src/github.com/openshift/origin
+++ OS_ROOT=/Users/xiaods/go/src/github.com/openshift/origin
+++ export OS_ROOT
+++ cd /Users/xiaods/go/src/github.com/openshift/origin
++++ find /Users/xiaods/go/src/github.com/openshift/origin/hack/lib -type f -name '*.sh' -not -path '*/hack/lib/init.sh'
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/archive.sh
++++ readonly -f os::build::archive::name
++++ readonly -f os::build::archive::zip
++++ readonly -f os::build::archive::tar
++++ readonly -f os::build::archive::internal::is_hardlink_supported
++++ readonly -f os::build::archive::extract_tar
++++ readonly -f os::build::archive::detect_local_release_tars
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/binaries.sh
++++ readonly -f os::build::binaries_from_targets
++++ readonly -f os::build::host_platform
++++ readonly -f os::build::host_platform_friendly
++++ readonly -f os::build::platform_arch
++++ readonly -f os::build::setup_env
++++ readonly -f os::build::build_static_binaries
++++ readonly -f os::build::build_binaries
++++ readonly -f os::build::export_targets
++++ readonly -f os::build::place_bins
++++ readonly -f os::build::release_sha
++++ readonly -f os::build::make_openshift_binary_symlinks
++++ readonly -f os::build::ldflag
++++ readonly -f os::build::require_clean_tree
++++ readonly -f os::build::commit_range
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/environment.sh
++++ readonly -f os::build::environment::create
++++ readonly -f os::build::environment::release::workingdir
++++ readonly -f os::build::environment::cleanup
++++ readonly -f os::build::environment::start
++++ readonly -f os::build::environment::withsource
++++ readonly -f os::build::environment::volume_name
++++ readonly -f os::build::environment::remove_volume
++++ readonly -f os::build::environment::run
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/images.sh
++++ readonly -f os::build::image
++++ readonly -f os::build::image::internal::generic
++++ readonly -f os::build::image::internal::imagebuilder
++++ readonly -f os::build::image::internal::docker
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/release.sh
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/rpm.sh
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/build/version.sh
++++ readonly -f os::build::version::get_vars
++++ readonly -f os::build::version::git_vars
++++ readonly -f os::build::version::etcd_vars
++++ readonly -f os::build::version::kubernetes_vars
++++ readonly -f os::build::version::save_vars
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/cleanup.sh
++++ readonly -f os::cleanup::all
++++ readonly -f os::cleanup::dump_etcd
++++ readonly -f os::cleanup::internal::dump_etcd_v3
++++ readonly -f os::cleanup::prune_etcd
++++ readonly -f os::cleanup::containers
++++ readonly -f os::cleanup::dump_container_logs
++++ readonly -f os::cleanup::internal::list_our_containers
++++ readonly -f os::cleanup::internal::list_k8s_containers
++++ readonly -f os::cleanup::internal::list_containers
++++ readonly -f os::cleanup::tmpdir
++++ readonly -f os::cleanup::dump_events
++++ readonly -f os::cleanup::find_cache_alterations
++++ readonly -f os::cleanup::dump_pprof_output
++++ readonly -f os::cleanup::truncate_large_logs
++++ readonly -f os::cleanup::processes
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/cmd.sh
++++ readonly -f os::cmd::expect_success
++++ readonly -f os::cmd::expect_failure
++++ readonly -f os::cmd::expect_success_and_text
++++ readonly -f os::cmd::expect_failure_and_text
++++ readonly -f os::cmd::expect_success_and_not_text
++++ readonly -f os::cmd::expect_failure_and_not_text
++++ readonly -f os::cmd::expect_code
++++ readonly -f os::cmd::expect_code_and_text
++++ readonly -f os::cmd::expect_code_and_not_text
++++ millisecond=1
++++ second=1000
++++ minute=60000
++++ readonly -f os::cmd::try_until_success
++++ readonly -f os::cmd::try_until_failure
++++ readonly -f os::cmd::try_until_text
++++ readonly -f os::cmd::try_until_text
++++ os_cmd_internal_tmpdir=/var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift
++++ os_cmd_internal_tmpout=/var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift/tmp_stdout.log
++++ os_cmd_internal_tmperr=/var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift/tmp_stderr.log
++++ readonly -f os::cmd::internal::expect_exit_code_run_grep
++++ readonly -f os::cmd::internal::init_tempdir
++++ readonly -f os::cmd::internal::describe_call
++++ readonly -f os::cmd::internal::determine_caller
++++ readonly -f os::cmd::internal::describe_expectation
++++ readonly -f os::cmd::internal::seconds_since_epoch
++++ readonly -f os::cmd::internal::run_collecting_output
++++ readonly -f os::cmd::internal::success_func
++++ readonly -f os::cmd::internal::failure_func
++++ readonly -f os::cmd::internal::specific_code_func
++++ readonly -f os::cmd::internal::get_results
++++ readonly -f os::cmd::internal::get_last_results
++++ readonly -f os::cmd::internal::mark_attempt
++++ readonly -f os::cmd::internal::compress_output
++++ readonly -f os::cmd::internal::print_results
++++ readonly -f os::cmd::internal::assemble_causes
++++ readonly -f os::cmd::internal::run_until_exit_code
++++ readonly -f os::cmd::internal::run_until_text
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/constants.sh
++++ readonly OS_GO_PACKAGE=github.com/openshift/origin
++++ OS_GO_PACKAGE=github.com/openshift/origin
++++ readonly OS_BUILD_ENV_GOLANG=1.8
++++ OS_BUILD_ENV_GOLANG=1.8
++++ readonly OS_BUILD_ENV_IMAGE=openshift/origin-release:golang-1.8
++++ OS_BUILD_ENV_IMAGE=openshift/origin-release:golang-1.8
++++ readonly OS_REQUIRED_GO_VERSION=go1.8
++++ OS_REQUIRED_GO_VERSION=go1.8
++++ readonly 'OS_GOFLAGS_TAGS=include_gcs include_oss containers_image_openpgp'
++++ OS_GOFLAGS_TAGS='include_gcs include_oss containers_image_openpgp'
++++ readonly OS_GOFLAGS_TAGS_LINUX_AMD64=gssapi
++++ OS_GOFLAGS_TAGS_LINUX_AMD64=gssapi
++++ readonly OS_GOFLAGS_TAGS_LINUX_S390X=gssapi
++++ OS_GOFLAGS_TAGS_LINUX_S390X=gssapi
++++ readonly OS_GOFLAGS_TAGS_LINUX_ARM64=gssapi
++++ OS_GOFLAGS_TAGS_LINUX_ARM64=gssapi
++++ readonly OS_GOFLAGS_TAGS_LINUX_PPC64LE=gssapi
++++ OS_GOFLAGS_TAGS_LINUX_PPC64LE=gssapi
++++ readonly OS_OUTPUT_BASEPATH=_output
++++ OS_OUTPUT_BASEPATH=_output
++++ readonly OS_BASE_OUTPUT=/Users/xiaods/go/src/github.com/openshift/origin/_output
++++ OS_BASE_OUTPUT=/Users/xiaods/go/src/github.com/openshift/origin/_output
++++ readonly OS_OUTPUT_SCRIPTPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts
++++ OS_OUTPUT_SCRIPTPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts
++++ readonly OS_OUTPUT_SUBPATH=_output/local
++++ OS_OUTPUT_SUBPATH=_output/local
++++ readonly OS_OUTPUT=/Users/xiaods/go/src/github.com/openshift/origin/_output/local
++++ OS_OUTPUT=/Users/xiaods/go/src/github.com/openshift/origin/_output/local
++++ readonly OS_OUTPUT_RELEASEPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/releases
++++ OS_OUTPUT_RELEASEPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/releases
++++ readonly OS_OUTPUT_RPMPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/releases/rpms
++++ OS_OUTPUT_RPMPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/releases/rpms
++++ readonly OS_OUTPUT_BINPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin
++++ OS_OUTPUT_BINPATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin
++++ readonly OS_OUTPUT_PKGDIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/pkgdir
++++ OS_OUTPUT_PKGDIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/pkgdir
++++ OS_SDN_COMPILE_TARGETS_LINUX=(pkg/network/sdn-cni-plugin vendor/github.com/containernetworking/cni/plugins/ipam/host-local vendor/github.com/containernetworking/cni/plugins/main/loopback)
++++ readonly OS_SDN_COMPILE_TARGETS_LINUX
++++ OS_IMAGE_COMPILE_TARGETS_LINUX=(cmd/dockerregistry cmd/gitserver vendor/k8s.io/kubernetes/cmd/hyperkube "${OS_SDN_COMPILE_TARGETS_LINUX[@]}")
++++ readonly OS_IMAGE_COMPILE_TARGETS_LINUX
++++ OS_SCRATCH_IMAGE_COMPILE_TARGETS_LINUX=(images/pod examples/hello-openshift)
++++ readonly OS_SCRATCH_IMAGE_COMPILE_TARGETS_LINUX
++++ OS_IMAGE_COMPILE_BINARIES=("${OS_SCRATCH_IMAGE_COMPILE_TARGETS_LINUX[@]##*/}" "${OS_IMAGE_COMPILE_TARGETS_LINUX[@]##*/}")
++++ readonly OS_IMAGE_COMPILE_BINARIES
++++ OS_CROSS_COMPILE_TARGETS=(cmd/openshift cmd/oc cmd/kubefed cmd/template-service-broker)
++++ readonly OS_CROSS_COMPILE_TARGETS
++++ OS_CROSS_COMPILE_BINARIES=("${OS_CROSS_COMPILE_TARGETS[@]##*/}")
++++ readonly OS_CROSS_COMPILE_BINARIES
++++ OS_TEST_TARGETS=(test/extended/extended.test)
++++ readonly OS_TEST_TARGETS
++++ OS_GOVET_BLACKLIST=("pkg/.*/client/clientset_generated/internalclientset/fake/clientset_generated.go:[0-9]+: literal copies lock value from fakePtr: github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/testing/core.Fake" "pkg/.*/client/clientset_generated/release_v1_./fake/clientset_generated.go:[0-9]+: literal copies lock value from fakePtr: github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/testing/core.Fake" "pkg/.*/clientset/internalclientset/fake/clientset_generated.go:[0-9]+: literal copies lock value from fakePtr: github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/testing/core.Fake" "pkg/.*/clientset/release_v3_./fake/clientset_generated.go:[0-9]+: literal copies lock value from fakePtr: github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/testing/core.Fake" "cmd/cluster-capacity/.*")
++++ readonly OS_GOVET_BLACKLIST
++++ OPENSHIFT_BINARY_SYMLINKS=(openshift-router openshift-deploy openshift-recycle openshift-sti-build openshift-docker-build openshift-git-clone openshift-manage-dockerfile openshift-extract-image-content origin osc oadm osadm kubectl kubernetes kubelet kube-proxy kube-apiserver kube-controller-manager kube-scheduler)
++++ readonly OPENSHIFT_BINARY_SYMLINKS
++++ OPENSHIFT_BINARY_COPY=(oadm kubelet kube-proxy kube-apiserver kube-controller-manager kube-scheduler)
++++ readonly OPENSHIFT_BINARY_COPY
++++ OC_BINARY_COPY=(kubectl)
++++ readonly OC_BINARY_COPY
++++ OS_BINARY_RELEASE_CLIENT_WINDOWS=(oc.exe README.md ./LICENSE)
++++ readonly OS_BINARY_RELEASE_CLIENT_WINDOWS
++++ OS_BINARY_RELEASE_CLIENT_MAC=(oc README.md ./LICENSE)
++++ readonly OS_BINARY_RELEASE_CLIENT_MAC
++++ OS_BINARY_RELEASE_CLIENT_LINUX=(./oc ./README.md ./LICENSE)
++++ readonly OS_BINARY_RELEASE_CLIENT_LINUX
++++ OS_BINARY_RELEASE_SERVER_LINUX=('./*')
++++ readonly OS_BINARY_RELEASE_SERVER_LINUX
++++ OS_BINARY_RELEASE_CLIENT_EXTRA=(${OS_ROOT}/README.md ${OS_ROOT}/LICENSE)
++++ readonly OS_BINARY_RELEASE_CLIENT_EXTRA
++++ readonly -f os::build::ldflags
++++ readonly -f os::util::list_go_src_files
++++ readonly -f os::util::list_go_src_dirs
++++ readonly -f os::util::list_test_packages_under
++++ readonly -f os::build::generate_windows_versioninfo
++++ readonly -f os::build::clean_windows_versioninfo
++++ OS_ALL_IMAGES=(openshift/origin openshift/origin-base openshift/origin-pod openshift/origin-deployer openshift/origin-docker-builder openshift/origin-docker-registry openshift/origin-keepalived-ipfailover openshift/origin-sti-builder openshift/origin-haproxy-router openshift/origin-f5-router openshift/origin-egress-router openshift/origin-egress-http-proxy openshift/origin-recycler openshift/origin-gitserver openshift/origin-cluster-capacity openshift/origin-service-catalog openshift/origin-template-service-broker openshift/hello-openshift openshift/openvswitch openshift/node)
++++ readonly OS_ALL_IMAGES
++++ readonly -f os::build::images
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/log/output.sh
++++ readonly -f os::log::info
++++ readonly -f os::log::warning
++++ readonly -f os::log::error
++++ readonly -f os::log::fatal
++++ readonly -f os::log::debug
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/log/stacktrace.sh
++++ readonly -f os::log::stacktrace::install
++++ readonly -f os::log::stacktrace::print
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/log/system.sh
++++ readonly -f os::log::system::install_cleanup
++++ readonly -f os::log::system::clean_up
++++ readonly -f os::log::system::internal::prune_datafile
++++ readonly -f os::log::system::internal::plot
++++ readonly -f os::log::system::start
++++ readonly -f os::log::system::internal::run
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/start.sh
++++ readonly -f os::start::configure_server
++++ readonly -f os::start::internal::create_master_certs
++++ readonly -f os::start::internal::configure_node
++++ readonly -f os::start::internal::configure_master
++++ readonly -f os::start::internal::patch_master_config
++++ readonly -f os::start::server
++++ readonly -f os::start::master
++++ readonly -f os::start::all_in_one
++++ readonly -f os::start::etcd
++++ readonly -f os::start::api_server
++++ readonly -f os::start::controllers
++++ readonly -f os::start::internal::start_node
++++ readonly -f os::start::internal::openshift_executable
++++ readonly -f os::start::internal::determine_hostnames
++++ readonly -f os::start::router
++++ readonly -f os::start::registry
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/test/junit.sh
++++ readonly -f os::test::junit::declare_suite_start
++++ readonly -f os::test::junit::declare_suite_end
++++ readonly -f os::test::junit::declare_test_start
++++ readonly -f os::test::junit::declare_test_end
++++ readonly -f os::test::junit::check_test_counters
++++ readonly -f os::test::junit::reconcile_output
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/docs.sh
++++ readonly -f generate_manual_pages
++++ readonly -f generate_documentation
++++ readonly -f os::util::gen-docs
++++ readonly -f os::util::set-man-placeholder
++++ readonly -f os::util::set-docs-placeholder
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/ensure.sh
++++ readonly -f os::util::ensure::system_binary_exists
++++ readonly -f os::util::ensure::built_binary_exists
++++ readonly -f os::util::ensure::gopath_binary_exists
++++ readonly -f os::util::ensure::iptables_privileges_exist
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/environment.sh
++++ readonly -f os::util::environment::use_sudo
++++ readonly -f os::util::environment::setup_time_vars
++++ readonly -f os::util::environment::setup_all_server_vars
++++ readonly -f os::util::environment::update_path_var
++++ readonly -f os::util::environment::setup_tmpdir_vars
++++ readonly -f os::util::environment::setup_kubelet_vars
++++ readonly -f os::util::environment::setup_etcd_vars
++++ readonly -f os::util::environment::setup_server_vars
++++ readonly -f os::util::environment::setup_images_vars
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/find.sh
++++ readonly -f os::util::find::system_binary
++++ readonly -f os::util::find::built_binary
++++ readonly -f os::util::find::gopath_binary
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/golang.sh
++++ readonly -f os::golang::verify_go_version
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/misc.sh
++++ readonly -f os::util::describe_return_code
++++ readonly -f os::util::install_describe_return_code
++++ [[ -z '' ]]
+++++ pwd
++++ OS_ORIGINAL_WD=/Users/xiaods/go/src/github.com/openshift/origin
++++ readonly OS_ORIGINAL_WD
++++ export OS_ORIGINAL_WD
++++ readonly -f os::util::repository_relative_path
++++ readonly -f os::util::format_seconds
++++ readonly -f os::util::sed
++++ readonly -f os::util::base64decode
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/text.sh
++++ readonly -f os::text::reset
++++ readonly -f os::text::bold
++++ readonly -f os::text::red
++++ readonly -f os::text::green
++++ readonly -f os::text::blue
++++ readonly -f os::text::yellow
++++ readonly -f os::text::clear_last_line
++++ readonly -f os::text::internal::is_tty
++++ readonly -f os::text::print_bold
++++ readonly -f os::text::print_red
++++ readonly -f os::text::print_red_bold
++++ readonly -f os::text::print_green
++++ readonly -f os::text::print_green_bold
++++ readonly -f os::text::print_blue
++++ readonly -f os::text::print_blue_bold
++++ readonly -f os::text::print_yellow
++++ readonly -f os::text::print_yellow_bold
+++ for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' )
+++ source /Users/xiaods/go/src/github.com/openshift/origin/hack/lib/util/trap.sh
++++ readonly -f os::util::trap::init_err
++++ readonly -f os::util::trap::init_exit
++++ readonly -f os::util::trap::err_handler
++++ readonly -f os::util::trap::exit_handler
+++ unset library_files library_file init_source
+++ os::log::stacktrace::install
+++ set -o errtrace
+++ export OS_USE_STACKTRACE=true
+++ OS_USE_STACKTRACE=true
+++ os::util::trap::init_err
+++ trap -p ERR
+++ grep -q os::util::trap::err_handler
+++ trap 'os::util::trap::err_handler;' ERR
+++ os::util::environment::update_path_var
+++ local prefix
+++ os::util::find::system_binary go
++++ os::build::host_platform
+++++ go env GOHOSTOS
+++++ go env GOHOSTARCH
++++ echo darwin/amd64
+++ prefix+=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64:
+++ [[ -n /Users/xiaods/go ]]
+++ prefix+=/Users/xiaods/go/bin:
+++ PATH=/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64:/Users/xiaods/go/bin:/usr/local/opt/openssl/bin:/Users/xiaods/.cargo/bin:/usr/local/opt/maven/libexec/bin:/usr/local/sbin:/usr/local/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/opt/openssl/bin:/Users/xiaods/.cargo/bin:/usr/local/opt/maven/libexec/bin:/usr/local/sbin:/usr/local/share/npm/bin:/Users/xiaods/go/bin:/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64/:/Users/xiaods/go/bin
+++ export PATH
+++ [[ -z '' ]]
++++ basename -bash .sh
basename: illegal option -- b
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]
+++++ os::util::trap::err_handler
+++++ local -r return_code=1
+++++ local -r 'last_command=basename "$0" ".sh"'
+++++ set +o
+++++ grep -q '\-o errexit'
+++++ [[ '' = \t\r\u\e ]]
+++++ [[ true = \t\r\u\e ]]
+++++ os::log::stacktrace::print 1 'basename "$0" ".sh"' ''
+++++ local return_code=1
+++++ local 'last_command=basename "$0" ".sh"'
+++++ local errexit_set=
+++++ [[ 1 = \0 ]]
+++++ [[ -z '' ]]
+++++ return 0
+++++ return 1
+++ os::util::environment::setup_tmpdir_vars ''
+++ local sub_dir=
+++ BASETMPDIR=/var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift/
+++ export BASETMPDIR
+++ VOLUME_DIR=/var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift//volumes
+++ export VOLUME_DIR
+++ BASEOUTDIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts/
+++ export BASEOUTDIR
+++ LOG_DIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//logs
+++ export LOG_DIR
+++ ARTIFACT_DIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//artifacts
+++ export ARTIFACT_DIR
+++ FAKE_HOME_DIR=/Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//openshift.local.home
+++ export FAKE_HOME_DIR
+++ mkdir -p /Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//logs /var/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T//openshift//volumes /Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//artifacts /Users/xiaods/go/src/github.com/openshift/origin/_output/scripts//openshift.local.home
+++ export OS_TMP_ENV_SET=
+++ OS_TMP_ENV_SET=
+++ [[ -n '' ]]
+++ os::build::host_platform
++++ go env GOHOSTOS
++++ go env GOHOSTARCH
+++ echo darwin/amd64
++ echo /Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64/
PATH=/usr/local/opt/openssl/bin:/Users/xiaods/.cargo/bin:/usr/local/opt/maven/libexec/bin:/usr/local/sbin:/usr/local/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/opt/openssl/bin:/Users/xiaods/.cargo/bin:/usr/local/opt/maven/libexec/bin:/usr/local/sbin:/usr/local/share/npm/bin:/Users/xiaods/go/bin:/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64/:/Users/xiaods/go/bin:/Users/xiaods/go/src/github.com/openshift/origin/_output/local/bin/darwin/amd64/
xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel*
$

@stevekuznetsov
Copy link
Contributor

@xiaods can you also please print?

$ echo $( echo $0 )

The logic in hack/lib/init.sh is wrong -- it thinks it's always running from a script but it is not. Specifically, this is wrong:

origin/hack/lib/init.sh

Lines 53 to 55 in 1ed4596

if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
fi

@xiaods
Copy link
Contributor Author

xiaods commented Nov 14, 2017

it output

$ echo $( echo $0 )
-bash

@stevekuznetsov
Copy link
Contributor

That's very interesting. Could you change this patch to instead detect when $0 doesn't end in .sh and use something other than the basename call in that case?

hack/lib/init.sh Outdated
@@ -51,7 +51,7 @@ os::log::stacktrace::install
os::util::environment::update_path_var

if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
os::util::environment::setup_tmpdir_vars "$( basename -- "$0" ".sh" )"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should do:

if [[ "$0" ~= *.sh ]]; then
   os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
else
    os::util::environment::setup_tmpdir_vars "shell"
fi

The intent here was not to create a dir for the name of your shell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update done.

@xiaods
Copy link
Contributor Author

xiaods commented Nov 16, 2017

also report error:

$ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
-bash: -bash: not found command

@stevekuznetsov
Copy link
Contributor

You'll want to trace the error -- I would not expect -bash to match:

$ [[ "-bash" == *.sh ]] && echo matches
$ [[ "ba.sh" == *.sh ]] && echo matches
matches

@xiaods
Copy link
Contributor Author

xiaods commented Nov 21, 2017

@stevekuznetsov finally fix it. please have a look the patch

hack/lib/init.sh Outdated
@@ -50,8 +50,10 @@ os::log::stacktrace::install
# them before every invocation.
os::util::environment::update_path_var

if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

We still want this condition as the top-level if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix it.

hack/lib/init.sh Outdated
@@ -50,8 +50,10 @@ os::log::stacktrace::install
# them before every invocation.
os::util::environment::update_path_var

if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
if [[ -z "${OS_TMP_ENV_SET-}" ]] && [[ "$0" =~ *.sh ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I think in this case we are still not having the same logic -- would want:

if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
    if [[ "$0" =~ *.sh ]]; then
       os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
    else
        os::util::environment::setup_tmpdir_vars "shell"
    fi
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @stevekuznetsov , i have been done.

…ing with -

issue:
```
xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel*
$ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )"
basename: illegal option -- b
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]
```
caused by :

The -- (dash dash) stops basename from processing any options in the argument.
Always quote $0 in case there are spaces in the name.
@stevekuznetsov
Copy link
Contributor

/ok-to-test
/lgtm
/approve

Thanks @xiaods

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 28, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stevekuznetsov, xiaods

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 28, 2017
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 29, 2017

@xiaods: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_install_update 7250412 link /test extended_conformance_install_update

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17476, 17143, 15115, 17094, 17500).

@openshift-merge-robot openshift-merge-robot merged commit 32c11e8 into openshift:master Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants