Makefile in linux: what is the reason I can overwrite files without permission?

Joop

Can someone explain to me why make can freely overwrite existing files? For instance:

JAVA_FILES = example.java, example2.java

submit: example.zip

example.zip: $(JAVA_FILES)
zip $@ $^ 

In the terminal, not-rooted I type this and get what I expect:

user@computer :~$ make submit
zip example.zip example.java, example2.java
adding: example.java (deflated 53%)
adding: example2.java (deflated 53%)

What I did not expect is that if I now make a small change to example.java (for instance), and make submit again, the old file is overwritten without any kind of prompting. How is it possible that it doesn't need (my) permission to overwrite or sudo?

John Bollinger

If -- on your behalf -- make can create the .zip file in the first place, then there's no special reason to suppose that make cannot also modify the file on your behalf. The make program is not operating as some independent third party: when you run it, it is operating as you (for whatever the current sense of "you" is). The only reason to suppose that it might have a permission issue is if your default umask is set to disallow you modifying files you create, say 0222. That would be very unusual, and inconvenient.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Linux file permission "/rwx------". What does the slash mean and how can I access my files?

From Dev

Permission to overwrite files

From Dev

Permission to overwrite files

From Dev

What can be reason for getting "execute permission denied" in cronjob in UNIX?

From Dev

How can I get symlinks and which files they target without any permission info, date, etc.?

From Dev

Can I execute a Linux binary without the execute permission bit being set?

From Dev

Can I define FEATURE without defining PERMISSION, What is exact difference between both?

From Dev

Permission denied when trying to compile own shell in linux, what can I do?

From Dev

Can't move files to trash without any permission issues

From Dev

Can't move files to trash without any permission issues

From Dev

Makefile working in Linux but not under Windows, can't find files in subdirectory

From Dev

Can you change permission to all files except one directory in Linux?

From Dev

For what reason I can access the resources by curl, but not in the browser?

From Dev

sftp user can't see files, what is the right permission

From Dev

Why can I access all my files without a password when booting with a Chakra Linux live CD?

From Dev

How can i get simple makefile tutorial without compilers

From Dev

Can I generate a Makefile help without listing down all targets?

From Dev

What can I do with the windows files without being able to boot that windows?

From Java

Can i use firebase cloud messaging without notification permission? (Javascript)

From Dev

Can I get access to NFC without manifest permission in android?

From Dev

How can I configure Windows 7 to not run updates without permission?

From Dev

Can I install libXcomposite.so without the root permission?

From Dev

Why can I remove file without user permission?

From Dev

Why can I list other users processes without root permission?

From Dev

Can I install a service worker without permission of push notification?

From Dev

Can I record browser screen without user permission?

From Dev

When installing a package, can I give write permission to specific files?

From Dev

How can I check read permission of /proc/*/* files?

From Dev

Saving Files from a Loop Without Overwrite

Related Related

  1. 1

    Linux file permission "/rwx------". What does the slash mean and how can I access my files?

  2. 2

    Permission to overwrite files

  3. 3

    Permission to overwrite files

  4. 4

    What can be reason for getting "execute permission denied" in cronjob in UNIX?

  5. 5

    How can I get symlinks and which files they target without any permission info, date, etc.?

  6. 6

    Can I execute a Linux binary without the execute permission bit being set?

  7. 7

    Can I define FEATURE without defining PERMISSION, What is exact difference between both?

  8. 8

    Permission denied when trying to compile own shell in linux, what can I do?

  9. 9

    Can't move files to trash without any permission issues

  10. 10

    Can't move files to trash without any permission issues

  11. 11

    Makefile working in Linux but not under Windows, can't find files in subdirectory

  12. 12

    Can you change permission to all files except one directory in Linux?

  13. 13

    For what reason I can access the resources by curl, but not in the browser?

  14. 14

    sftp user can't see files, what is the right permission

  15. 15

    Why can I access all my files without a password when booting with a Chakra Linux live CD?

  16. 16

    How can i get simple makefile tutorial without compilers

  17. 17

    Can I generate a Makefile help without listing down all targets?

  18. 18

    What can I do with the windows files without being able to boot that windows?

  19. 19

    Can i use firebase cloud messaging without notification permission? (Javascript)

  20. 20

    Can I get access to NFC without manifest permission in android?

  21. 21

    How can I configure Windows 7 to not run updates without permission?

  22. 22

    Can I install libXcomposite.so without the root permission?

  23. 23

    Why can I remove file without user permission?

  24. 24

    Why can I list other users processes without root permission?

  25. 25

    Can I install a service worker without permission of push notification?

  26. 26

    Can I record browser screen without user permission?

  27. 27

    When installing a package, can I give write permission to specific files?

  28. 28

    How can I check read permission of /proc/*/* files?

  29. 29

    Saving Files from a Loop Without Overwrite

HotTag

Archive