Why did install command overwrite (destroy) my directory? [on hold]











up vote
0
down vote

favorite












I was viewing the output from Makefile.pdlibbuilder, and it looked like this:



....
install -m 755 -d -v "/usr/lib/pd/extra/MyPlugin~"
install -p -m 644 'MyPlugin~-help.pd' "/usr/lib/pd/extra/MyPlugin~";
install -p -m 644 'MyPlugin~-meta.pd' "/usr/lib/pd/extra/MyPlugin~";
install -p -m 644 'README.txt' "/usr/lib/pd/extra/MyPlugin~";
....


So, I gathered, the first command creates a directory, the other commands copy files in that directory. Good enough.



So, I wanted to copy a file to a directory, and so tried this in my makefile:



install-myfile:
@echo "Note: DESTDIR '$(DESTDIR)' PDLIBDIR '$(PDLIBDIR)' <- myfile.txt"
$(INSTALL_PROGRAM) myfile.txt "$(DESTDIR)$(PDLIBDIR)";


I run this, I get on output:



install -p -m 644 myfile.txt "/usr/local/lib/pd-externals";


... however, what this did, is removed existing directory /usr/local/lib/pd-externals, and copied myfile.txt under the name /usr/local/lib/pd-externals!!!!



I guess, it makes sense, since if (say) cp does not see a trailing slash, it thinks the path is a file; - and if it sees a trailing slash, it thinks it's a directory. BUT, the original examples that I was looking at do NOT include a trailing slash either - and yet they don't destroy directories, that is, overwrite them as a file?!



I don't really use install, so, I am really puzzled - why did this happen?



Note that the permissions -p -m 644 are apparently part of the $(INSTALL_PROGRAM) Makefile macro.



Did I really need a trailing slash for the directory, and if so, how is it possible that the ones in my example did not need one? Or - why did this happen?





EDIT: re-ran this a couple of times, and it turns out, if a directory doesn't already exists, the result of the process is a file at the directory path; but if a directory DOES exist already, then the file is copied inside it, regardless of the trailing slash. So it must be, I didn't have this directory to begin with...










share|improve this question















put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man Dec 4 at 21:24


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man

If this question can be reworded to fit the rules in the help center, please edit the question.

















    up vote
    0
    down vote

    favorite












    I was viewing the output from Makefile.pdlibbuilder, and it looked like this:



    ....
    install -m 755 -d -v "/usr/lib/pd/extra/MyPlugin~"
    install -p -m 644 'MyPlugin~-help.pd' "/usr/lib/pd/extra/MyPlugin~";
    install -p -m 644 'MyPlugin~-meta.pd' "/usr/lib/pd/extra/MyPlugin~";
    install -p -m 644 'README.txt' "/usr/lib/pd/extra/MyPlugin~";
    ....


    So, I gathered, the first command creates a directory, the other commands copy files in that directory. Good enough.



    So, I wanted to copy a file to a directory, and so tried this in my makefile:



    install-myfile:
    @echo "Note: DESTDIR '$(DESTDIR)' PDLIBDIR '$(PDLIBDIR)' <- myfile.txt"
    $(INSTALL_PROGRAM) myfile.txt "$(DESTDIR)$(PDLIBDIR)";


    I run this, I get on output:



    install -p -m 644 myfile.txt "/usr/local/lib/pd-externals";


    ... however, what this did, is removed existing directory /usr/local/lib/pd-externals, and copied myfile.txt under the name /usr/local/lib/pd-externals!!!!



    I guess, it makes sense, since if (say) cp does not see a trailing slash, it thinks the path is a file; - and if it sees a trailing slash, it thinks it's a directory. BUT, the original examples that I was looking at do NOT include a trailing slash either - and yet they don't destroy directories, that is, overwrite them as a file?!



    I don't really use install, so, I am really puzzled - why did this happen?



    Note that the permissions -p -m 644 are apparently part of the $(INSTALL_PROGRAM) Makefile macro.



    Did I really need a trailing slash for the directory, and if so, how is it possible that the ones in my example did not need one? Or - why did this happen?





    EDIT: re-ran this a couple of times, and it turns out, if a directory doesn't already exists, the result of the process is a file at the directory path; but if a directory DOES exist already, then the file is copied inside it, regardless of the trailing slash. So it must be, I didn't have this directory to begin with...










    share|improve this question















    put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man Dec 4 at 21:24


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man

    If this question can be reworded to fit the rules in the help center, please edit the question.















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I was viewing the output from Makefile.pdlibbuilder, and it looked like this:



      ....
      install -m 755 -d -v "/usr/lib/pd/extra/MyPlugin~"
      install -p -m 644 'MyPlugin~-help.pd' "/usr/lib/pd/extra/MyPlugin~";
      install -p -m 644 'MyPlugin~-meta.pd' "/usr/lib/pd/extra/MyPlugin~";
      install -p -m 644 'README.txt' "/usr/lib/pd/extra/MyPlugin~";
      ....


      So, I gathered, the first command creates a directory, the other commands copy files in that directory. Good enough.



      So, I wanted to copy a file to a directory, and so tried this in my makefile:



      install-myfile:
      @echo "Note: DESTDIR '$(DESTDIR)' PDLIBDIR '$(PDLIBDIR)' <- myfile.txt"
      $(INSTALL_PROGRAM) myfile.txt "$(DESTDIR)$(PDLIBDIR)";


      I run this, I get on output:



      install -p -m 644 myfile.txt "/usr/local/lib/pd-externals";


      ... however, what this did, is removed existing directory /usr/local/lib/pd-externals, and copied myfile.txt under the name /usr/local/lib/pd-externals!!!!



      I guess, it makes sense, since if (say) cp does not see a trailing slash, it thinks the path is a file; - and if it sees a trailing slash, it thinks it's a directory. BUT, the original examples that I was looking at do NOT include a trailing slash either - and yet they don't destroy directories, that is, overwrite them as a file?!



      I don't really use install, so, I am really puzzled - why did this happen?



      Note that the permissions -p -m 644 are apparently part of the $(INSTALL_PROGRAM) Makefile macro.



      Did I really need a trailing slash for the directory, and if so, how is it possible that the ones in my example did not need one? Or - why did this happen?





      EDIT: re-ran this a couple of times, and it turns out, if a directory doesn't already exists, the result of the process is a file at the directory path; but if a directory DOES exist already, then the file is copied inside it, regardless of the trailing slash. So it must be, I didn't have this directory to begin with...










      share|improve this question















      I was viewing the output from Makefile.pdlibbuilder, and it looked like this:



      ....
      install -m 755 -d -v "/usr/lib/pd/extra/MyPlugin~"
      install -p -m 644 'MyPlugin~-help.pd' "/usr/lib/pd/extra/MyPlugin~";
      install -p -m 644 'MyPlugin~-meta.pd' "/usr/lib/pd/extra/MyPlugin~";
      install -p -m 644 'README.txt' "/usr/lib/pd/extra/MyPlugin~";
      ....


      So, I gathered, the first command creates a directory, the other commands copy files in that directory. Good enough.



      So, I wanted to copy a file to a directory, and so tried this in my makefile:



      install-myfile:
      @echo "Note: DESTDIR '$(DESTDIR)' PDLIBDIR '$(PDLIBDIR)' <- myfile.txt"
      $(INSTALL_PROGRAM) myfile.txt "$(DESTDIR)$(PDLIBDIR)";


      I run this, I get on output:



      install -p -m 644 myfile.txt "/usr/local/lib/pd-externals";


      ... however, what this did, is removed existing directory /usr/local/lib/pd-externals, and copied myfile.txt under the name /usr/local/lib/pd-externals!!!!



      I guess, it makes sense, since if (say) cp does not see a trailing slash, it thinks the path is a file; - and if it sees a trailing slash, it thinks it's a directory. BUT, the original examples that I was looking at do NOT include a trailing slash either - and yet they don't destroy directories, that is, overwrite them as a file?!



      I don't really use install, so, I am really puzzled - why did this happen?



      Note that the permissions -p -m 644 are apparently part of the $(INSTALL_PROGRAM) Makefile macro.



      Did I really need a trailing slash for the directory, and if so, how is it possible that the ones in my example did not need one? Or - why did this happen?





      EDIT: re-ran this a couple of times, and it turns out, if a directory doesn't already exists, the result of the process is a file at the directory path; but if a directory DOES exist already, then the file is copied inside it, regardless of the trailing slash. So it must be, I didn't have this directory to begin with...







      shell file-copy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 4 at 17:11

























      asked Dec 4 at 16:59









      sdaau

      2,59563148




      2,59563148




      put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man Dec 4 at 21:24


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man

      If this question can be reworded to fit the rules in the help center, please edit the question.




      put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man Dec 4 at 21:24


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Rui F Ribeiro, RalfFriedl, Fabby, Christopher, G-Man

      If this question can be reworded to fit the rules in the help center, please edit the question.



























          active

          oldest

          votes






















          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt