{"thread":{"id":"58656","subject":"[BUG] 'make install' may overwrite existing directories","startedAt":"2022-10-20T10:58:16Z","lastAt":"2022-10-20T10:58:16Z","messageCount":1,"participants":["Alejandro Colomar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"465286","messageId":"a49c95b2-4468-e510-957a-427f9ce8763d@gmail.com","threadId":"58656","inReplyTo":null,"subject":"[BUG] 'make install' may overwrite existing directories","fromName":"Alejandro Colomar","fromEmail":"alx.manpages@gmail.com","sentAt":"2022-10-20T10:58:00Z","receivedAt":"2022-10-20T10:58:16Z","isPatch":false,"sender":{"key":"alx.manpages@gmail.com","avatar":null},"body":"Hi,\n\nThe project Makefile defines the install target as:\n\n$ sed -n '3236,3245p' Makefile\n\ninstall: all\n\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n\t$(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) \n'$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n\t$(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n\t$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n\t$(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) \n'$(DESTDIR_SQ)$(bindir_SQ)'\n\t$(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'\n\n\nNotice that the directories are being installed even if they already \nexist.  This may be problematic in case the existing directories have a \ndifferent mode, or have SELinux security contexts, or any other \ncharacteristic that install(1) would overwrite.\n\nA similar bug report in an NGINX project can be found here:\n\n<https://github.com/nginx/unit/issues/769>\n\nThe two solutions available are:\n\n- Make the install target be a dummy target that depends on the files \nbeing installed, and write proper make(1) rules for those targets.  This \nwould be preferred.  You can check the Linux man-pages Makefile for an \nimplementation of the 'install' target that does this.\n\n- test(1) if the directory exists before actually creating it.  This is \na simple workaround.\n\n\nCheers,\n\nAlex\n\n\n-- \n<http://www.alejandro-colomar.es/>\n"}]}