• Let a soft symlinked directory work as if it is a physical one.

    From hongyi.zhao@gmail.com@21:1/5 to All on Mon Jan 31 00:37:09 2022
    I try to compile thermo_pw according to guidance here [1]. This package needs to be placed in the root directory of QE package [2] when compiling, i.e., with the following directory hierachy:

    qe-7.0/
    | thermo_pw

    If the thermo_pw directory above is a symbolic link to another location outside the QE package, the following compilation step issued from the symbolic link directory will fail as shown below:

    $ make join_qe
    if test -f main_Makefile ; then mv ../Makefile Makefile_qe ; \
    mv main_Makefile ../Makefile ; fi
    if test -f plugins_makefile ; then mv ../install/plugins_makefile \
    plugins_makefile_qe ; mv plugins_makefile ../install ; fi
    if test -f makedeps.sh ; then mv ../install/makedeps.sh \
    makedeps.sh_qe ; mv makedeps.sh ../install/ ; fi
    mv: cannot stat '../install/makedeps.sh': No such file or directory
    mv: cannot move 'makedeps.sh' to '../install/': Not a directory
    make: *** [Makefile:23: join_qe] Error 1

    So, I want to know if there is a way to let a soft symlinked directory work as if it is a physical one.

    [1] https://people.sissa.it/~dalcorso/thermo_pw/user_guide/node6.html
    [2] https://github.com/QEF/q-e/releases/download/qe-7.0/qe-7.0-ReleasePack.tgz

    Regards,
    HZ

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Smallshaw@21:1/5 to hongy...@gmail.com on Mon Jan 31 16:28:30 2022
    On 2022-01-31, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
    I try to compile thermo_pw according to guidance here [1]. This
    package needs to be placed in the root directory of QE package [2]
    when compiling, i.e., with the following directory hierachy:

    qe-7.0/
    | thermo_pw

    If the thermo_pw directory above is a symbolic link to another
    location outside the QE package, the following compilation step
    issued from the symbolic link directory will fail as shown below:

    $ make join_qe
    if test -f main_Makefile ; then mv ../Makefile Makefile_qe ; \
    mv main_Makefile ../Makefile ; fi

    Not going to work. .. will always refer to the physical parent
    since it has to be unambiguous - this is one of the reasons you
    can't hard link directories in the first place - the other is you
    could eventuality end up with directories isolated from the root.
    The trickery ksh and successors use to track the "logical" path is
    purely internal to the shell, any external process will always
    refer to the physical parent.

    On possible workaround would be to create a new parent directory
    containing the physical therm_pw directory and then symlinking the
    _contents_ of qe-7.0/ into that. That may or may not work. I'd
    expect most simple or well-structured projects not to depend on
    backing up to the parent so I would hope you will be in luck, but
    the easiest way to find out is simply to try it.

    However, I would caution about the motivation for wanting to do
    this in the first place. If you are expecting the original qe-7.0/
    to be left in an unaltered condition you can't depend on that in
    the general case, there is nothing to say the build products will
    remain the same or even that source files are not altered. You
    would hope so, but that is assuming thermo_pw is well-behaved. If
    it is it makes no difference whather it is physically in qe-7.0/
    or not. If it isn't the symlinks aren't going to help.

    --
    Andrew Smallshaw
    andrews@sdf.org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hongyi.zhao@gmail.com@21:1/5 to Andrew Smallshaw on Mon Jan 31 18:02:13 2022
    On Tuesday, February 1, 2022 at 12:28:35 AM UTC+8, Andrew Smallshaw wrote:
    On 2022-01-31, hongy...@gmail.com <hongy...@gmail.com> wrote:
    I try to compile thermo_pw according to guidance here [1]. This
    package needs to be placed in the root directory of QE package [2]
    when compiling, i.e., with the following directory hierachy:

    qe-7.0/
    | thermo_pw

    If the thermo_pw directory above is a symbolic link to another
    location outside the QE package, the following compilation step
    issued from the symbolic link directory will fail as shown below:

    $ make join_qe
    if test -f main_Makefile ; then mv ../Makefile Makefile_qe ; \
    mv main_Makefile ../Makefile ; fi
    Not going to work. .. will always refer to the physical parent
    since it has to be unambiguous - this is one of the reasons you
    can't hard link directories in the first place - the other is you
    could eventuality end up with directories isolated from the root.
    The trickery ksh and successors use to track the "logical" path is
    purely internal to the shell, any external process will always
    refer to the physical parent.

    On possible workaround would be to create a new parent directory
    containing the physical therm_pw directory and then symlinking the
    _contents_ of qe-7.0/ into that. That may or may not work. I'd
    expect most simple or well-structured projects not to depend on
    backing up to the parent so I would hope you will be in luck, but
    the easiest way to find out is simply to try it.

    However, I would caution about the motivation for wanting to do
    this in the first place. If you are expecting the original qe-7.0/
    to be left in an unaltered condition you can't depend on that in
    the general case, there is nothing to say the build products will
    remain the same or even that source files are not altered. You
    would hope so, but that is assuming thermo_pw is well-behaved. If
    it is it makes no difference whather it is physically in qe-7.0/
    or not. If it isn't the symlinks aren't going to help.

    I've come up with another solution that uses the latest rsync [1] which supplies the '--mkpath' option:

    $ tar zxvf qe-7.0-ReleasePack.tgz
    $ git clone https://github.com/dalcorso/thermo_pw.git thermo_pw.git
    $ rsync -avP --mkpath --delete thermo_pw.git/ ./qe-7.0/thermo_pw

    [1] https://github.com/WayneD/rsync

    HZ

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)