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

[minor] Non-silenced pushd followed by popd in tensorflow/configure #6555

Closed
z-a-f opened this issue Dec 29, 2016 · 6 comments
Closed

[minor] Non-silenced pushd followed by popd in tensorflow/configure #6555

z-a-f opened this issue Dec 29, 2016 · 6 comments
Assignees
Labels
type:build/install Build and install issues

Comments

@z-a-f
Copy link
Contributor

z-a-f commented Dec 29, 2016

tensorflow/configure has the following lines:

#!/usr/bin/env bash

set -e
set -o pipefail

# Find out the absolute path to where ./configure resides
pushd `dirname $0` #> /dev/null
SOURCE_BASE_DIR=`pwd -P`
popd > /dev/null

I am not sure what is the purpose of the pushd followed by popd without change in directory. I think this is not necessary, and distracts when reading the source codes. Unless it is allowed to run the configure from the directory other than the tensorflow root, it is completely redundant.

Also, the > /dev/null is commented out which causes the current directory to print when running the script:

$ ./configure
  ~/GitHub/tensorflow ~/GitHub/tensorflow
  Please specify the location of python. [Default is ~/.virtualenvs/tf-dev-env/bin/python]:
  .........
@gunan
Copy link
Contributor

gunan commented Dec 29, 2016

@aselle looks like you added the lines in question?

I believe this would be a sanity check, just making sure we are at the root.

@aselle
Copy link
Contributor

aselle commented Dec 29, 2016 via email

@z-a-f
Copy link
Contributor Author

z-a-f commented Dec 30, 2016

The pushd is silenced, but do we actually need it? I can see the use for it if we allow users to run configure from custom defined source directories. However, even in that case I would probably use something like

SOURCE_BASE_DIR=`pwd -P`
pushd ${PWD} >/dev/null
cd `dirname $0`
#
# Perform some actions in the directory where 'configure' is
#
popd >/dev/null
#
# Perform some actions in the directory where the scipt was called from
#

@aselle
Copy link
Contributor

aselle commented Jan 3, 2017

I'm confused. That code does seems to have an extra line and capture SOURCE_BASE_DIR of where you run it from rather than where configure is.

@aselle aselle added the stat:awaiting response Status - Awaiting response from author label Jan 3, 2017
@z-a-f
Copy link
Contributor Author

z-a-f commented Jan 3, 2017

@aselle That what the original script was doing -- I assumed it was on purpose -- the only reason it would be required is if there are two different locations that the script would have to work with: one where SOURCE_BASE_DIR is, and another where the configure is located. Assuming TF allows them to be in different locations, it makes sense to keep one of them on a stack, while working in the other. Otherwise, I think the script should be

#!/usr/bin/env bash

set -e
set -o pipefail

SOURCE_BASE_DIR=`pwd -P`

I was trying to see the Blame for the popd, pushd lines, and this is the only thing there:

It is necessary to symlink in files from .git/ in order to make
bazel aware of changes to the current head. As it is this is not
completely reliable when git repositories are in a dirty index
state. First class support for bazel git a reported bug but
not a high priority.

./configure sets up the symlinks by calling the gen_git_source.py
a bazel genrule calls gen_git_source.py to generate version_info.cc

Also changed cmake and make to build this properly.
Change: 132328009

@aselle aselle removed the stat:awaiting response Status - Awaiting response from author label Jan 3, 2017
@michaelisard michaelisard added the type:build/install Build and install issues label Jan 6, 2017
@gunan
Copy link
Contributor

gunan commented Feb 11, 2017

@zafartahirov I think for using tensorflow as is, you have a point. However, when tensorflow is an external dependency, such as how tensorflow/models or tensorflow/serving use TF, I believe users may need to run configure differently.

Also, as the pushd/popd lines have a comment describing what they do, I do not see a problem in terms of code readability.

Therefore, I am inclined to close this issue. Let me know if the above explanations do not address your concerns. We can reopen the issue if you disagree with my assessment above.

@gunan gunan closed this as completed Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants