unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
@ 2012-05-04  3:01 Donald Ephraim Curtis
  2012-05-10 18:52 ` Glenn Morris
  2015-12-25 21:37 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Donald Ephraim Curtis @ 2012-05-04  3:01 UTC (permalink / raw)
  To: 11400

It seems that `url-copy-file' does not respect the `umask' value.

Here I retrieve two files, first read into a buffer and the buffer is
written.  Second I use the `url-copy-file' function.  When looking at
the permissions, they are not as I would expect.


melpa :master*> umask
022
melpa :master*> emacs --batch --exec '(with-current-buffer (url-retrieve-synchronously "https://secure.gravatar.com/avatar/d07c1f81d10a1d147d6b5cb80fa1c654") (write-file "genehack.jpg"))'
Contacting host: secure.gravatar.com:443
Opening TLS connection to `secure.gravatar.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com --protocols ssl3'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect secure.gravatar.com:443 -no_ssl2 -ign_eof'...
Opening TLS connection with `openssl s_client -connect secure.gravatar.com:443 -no_ssl2 -ign_eof'...done
Opening TLS connection to `secure.gravatar.com'...done
Type C-c C-c to view the image as an image.
Cannot display image: (Display does not support images)
Saving file /Users/dcurtis/src/melpa/genehack.jpg...
Loading vc-git...
Wrote /Users/dcurtis/src/melpa/genehack.jpg
melpa :master*> emacs --batch --exec '(url-copy-file "https://secure.gravatar.com/avatar/d07c1f81d10a1d147d6b5cb80fa1c654" "genehack2.jpg" t)'
Contacting host: secure.gravatar.com:443
Opening TLS connection to `secure.gravatar.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com --protocols ssl3'...
Opening TLS connection with `gnutls-cli --insecure -p 443 secure.gravatar.com --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect secure.gravatar.com:443 -no_ssl2 -ign_eof'...
Opening TLS connection with `openssl s_client -connect secure.gravatar.com:443 -no_ssl2 -ign_eof'...done
Opening TLS connection to `secure.gravatar.com'...done
Wrote /Users/dcurtis/src/melpa/genehack2.jpg
melpa :master*> ll genehack*
-rw-r--r--  1 dcurtis  staff  3063 Mar 25 18:38 genehack.jpg
-rw-r--r--  1 dcurtis  staff  3063 Mar 25 18:38 genehack.jpg~
-rw-------  1 dcurtis  staff  2657 Mar 25 18:38 genehack2.jpg
melpa :master*> 



In GNU Emacs 24.0.95.1 (i386-apple-darwin11.3.0, NS apple-appkit-1138.32)
of 2012-04-06 on bird.local
Windowing system distributor `Apple', version 10.3.1138
Configured using:
`configure '--prefix=/usr/local/Cellar/emacs/HEAD' '--without-dbus'
'--enable-locallisppath=/usr/local/share/emacs/site-lisp'
'--infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs' '--with-ns'
'--disable-ns-self-contained' 'CC=/usr/bin/llvm-gcc' 'CFLAGS=-Os -w
-pipe -march=core2 -msse4''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  tar-subfile-mode: t
  diff-auto-refine-mode: t
  eldoc-mode: t
  elisp-slime-nav-mode: t
  paredit-mode: t
  hl-line-mode: t
  idle-highlight-mode: t
  whitespace-mode: t
  savehist-mode: t
  recentf-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
t o SPC M-d C-d M-d a C-e a n d SPC t h e SPC b u f 
f e r SPC i s SPC w r i t t e n . SPC SPC S e c o n 
d SPC I SPC u s e SPC t h e SPC ` u r l - c o p y - 
f i l ' <backspace> e ' SPC f u n c t i o n . SPC SPC 
N o t i c e SPC t h a t SPC t h e SPC C-w C-w C-w W 
h e n SPC l o o k i n g SPC a t SPC t h e SPC p e r 
m i s s i o n s , SPC t h e y SPC a r e SPC n o t SPC 
a s SPC I SPC w o u l d SPC e x p e c t . C-c C-c y 
C-x b C-g C-x C-b C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n <return> C-n C-n C-n C-n C-n C-n C-n C-n 
C-p C-n C-n C-n C-n C-n C-n C-f C-f C-f C-f C-f C-f 
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-b C-a 
C-p C-p C-p C-p C-p C-p C-p C-SPC C-n C-n C-n C-n C-n 
C-n C-n C-n C-n M-> M-w C-x b C-n <return> C-x 1 C-x 
RET <return>

Recent messages:
Auto-saving...done
Auto-saving...done
Send this bug report to the Emacs maintainers? (y or n)  y
Sending...
Sending via mail...
Sending...done
Quit
Formats have changed, recompiling...done
Updating buffer list...done
Mark set

Load-path shadows:
/Users/dcurtis/.emacs.d/elpa/jump-20120130/inflections hides /Users/dcurtis/.emacs.d/elpa/inflections-20100806/inflections
/Users/dcurtis/.emacs.d/elpa/jump-20120130/findr hides /Users/dcurtis/.emacs.d/elpa/findr-20120130/findr
~/.emacs.d/custom hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.95/lisp/custom
/Users/dcurtis/.emacs.d/elpa/jump-20120130/which-func hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.95/lisp/progmodes/which-func
/Users/dcurtis/.emacs.d/elpa/ruby-mode-20110630/ruby-mode hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.95/lisp/progmodes/ruby-mode
/Users/dcurtis/.emacs.d/elpa/full-ack-20120401/.dir-locals hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.95/lisp/gnus/.dir-locals

Features:
(ibuf-ext ibuffer mailalias mailclient browse-url qp shadow mail-extr
emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mailabbrev gmm-utils mailheader sendmail cus-theme cus-edit
lisp-mnt shell pcomplete evil evil-integration evil-commands ert ewoc
elp evil-maps evil-types evil-macros evil-repeat evil-search evil-ex
evil-states evil-core evil-digraphs evil-common undo-tree evil-vars rx
esh-var esh-io esh-cmd esh-ext esh-proc esh-arg esh-groups eshell
esh-module esh-mode esh-util derived ediff-merg ediff-diff ediff-wind
ediff-help ediff-util ediff-mult ediff-init ediff iswitchb diff compile
mule-util finder-inf expand-region-autoloads autoload mail-utils
network-stream starttls url-cache url-http tls mail-parse rfc2231
rfc2047 rfc2045 ietf-drums url-gw url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-util url-parse
auth-source eieio gnus-util password-cache url-vars mm-util mail-prsvr
mailcap sort checkdoc tar-mode pp two-column iso-transl dired
highlight-parentheses apropos find-file-in-project magit-bisect
magit-key-mode assoc magit diff-mode log-edit pcvs-util add-log rect
flyspell ispell markdown-mode noutline outline easy-mmode deft jka-compr
find-func imenu multi-isearch hippie-exp comint regexp-opt ansi-color
help-mode view debug hi-lock time-stamp newcomment vc-git eldoc
elisp-slime-nav etags ring paredit hl-line saveplace idle-highlight-mode
thingatpt whitespace melpa molokai-theme savehist recentf tree-widget
wid-edit autorevert cua-base cus-start cus-load server misc midnight
auctex-autoloads tex-site info easymenu deft-autoloads erlang-autoloads
evil-autoloads evil-leader-autoloads evil-numbers-autoloads
evil-surround-autoloads full-ack-autoloads
highlight-parentheses-autoloads markdown-mode+-autoloads
markdown-mode-autoloads melpa-autoloads byte-opt warnings bytecomp
byte-compile cconv macroexp rinari-autoloads jump-autoloads
inflections-autoloads findr-autoloads ruby-compilation-autoloads
ruby-mode-autoloads starter-kit-bindings-autoloads windmove
starter-kit-lisp-autoloads elisp-slime-nav-autoloads
starter-kit-ruby-autoloads starter-kit-autoloads edmacro kmacro smex
starter-kit-misc ffap ido-ubiquitous ido paren starter-kit-defuns
uniquify advice help-fns advice-preload magit-autoloads
ido-ubiquitous-autoloads smex-autoloads find-file-in-project-autoloads
idle-highlight-mode-autoloads paredit-autoloads inf-ruby-autoloads
undo-tree-autoloads package tabulated-list defun cl time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
  2012-05-04  3:01 bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask Donald Ephraim Curtis
@ 2012-05-10 18:52 ` Glenn Morris
  2012-05-10 20:28   ` Stefan Monnier
                     ` (2 more replies)
  2015-12-25 21:37 ` Lars Ingebrigtsen
  1 sibling, 3 replies; 6+ messages in thread
From: Glenn Morris @ 2012-05-10 18:52 UTC (permalink / raw)
  To: Donald Ephraim Curtis; +Cc: 11400

Donald Ephraim Curtis wrote:

> It seems that `url-copy-file' does not respect the `umask' value.

Well, you could put it that way, or you could say that by default it
creates private copies. Isn't this standard practice for many
applications that download things?

url-copy-file uses mm-save-part-to-file, which sets file modes according
to mm-attachment-file-modes. For world-readable, set that to 420.
There is no setting that means "don't change the mode bits"; maybe there
should be.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
  2012-05-10 18:52 ` Glenn Morris
@ 2012-05-10 20:28   ` Stefan Monnier
  2012-05-10 22:23   ` Donald Ephraim Curtis
  2012-09-05 19:32   ` Lars Ingebrigtsen
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2012-05-10 20:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11400, Donald Ephraim Curtis

>> It seems that `url-copy-file' does not respect the `umask' value.
> Well, you could put it that way, or you could say that by default it
> creates private copies. Isn't this standard practice for many
> applications that download things?
> url-copy-file uses mm-save-part-to-file, which sets file modes according
> to mm-attachment-file-modes. For world-readable, set that to 420.
> There is no setting that means "don't change the mode bits"; maybe there
> should be.

BTW, I don't like the idea of URL using so much of "mm-*".
That doesn't feel like the right structuring.  I tend to think of mm- as
higher-level, so I'd expect mm- to use URL functions, but not the other
way around.


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
  2012-05-10 18:52 ` Glenn Morris
  2012-05-10 20:28   ` Stefan Monnier
@ 2012-05-10 22:23   ` Donald Ephraim Curtis
  2012-09-05 19:32   ` Lars Ingebrigtsen
  2 siblings, 0 replies; 6+ messages in thread
From: Donald Ephraim Curtis @ 2012-05-10 22:23 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11400

> Well, you could put it that way, or you could say that by default it

> creates private copies. Isn't this standard practice for many
> applications that download things?

I don't agree with this argument.  Why is a "private" copy implied?  When I use `cp' I don't expect `cp' to dictate its own permissions.

What other applications behave in this way?  I use `curl' and `wget' to copy url contents and they respect the umask.

In the end, I don't care if this changes or not, but the bigger problem is that the documentation needs to direct people to the `mm-attachment-file-modes' variable because it is definitely not intuitive that the umask is determined from there.  


dc







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
  2012-05-10 18:52 ` Glenn Morris
  2012-05-10 20:28   ` Stefan Monnier
  2012-05-10 22:23   ` Donald Ephraim Curtis
@ 2012-09-05 19:32   ` Lars Ingebrigtsen
  2 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2012-09-05 19:32 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11400, Donald Ephraim Curtis

Glenn Morris <rgm@gnu.org> writes:

> Well, you could put it that way, or you could say that by default it
> creates private copies. Isn't this standard practice for many
> applications that download things?

It's standard for certain applications (like mail readers) to enforce a
separate umask, which is what Gnus does via `mm-save-part-to-file'.
However:

> url-copy-file uses mm-save-part-to-file, which sets file modes according
> to mm-attachment-file-modes. For world-readable, set that to 420.
> There is no setting that means "don't change the mode bits"; maybe there
> should be.

As Stefan points out, it's a bug for the url library to use this rather
high-level library to save stuff.  And the url library has no reason not
to heed the umask.

Anyway, this isn't a Gnus bug, so I'm reassigning it back to Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
  http://lars.ingebrigtsen.no  *  Lars Magne Ingebrigtsen





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask
  2012-05-04  3:01 bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask Donald Ephraim Curtis
  2012-05-10 18:52 ` Glenn Morris
@ 2015-12-25 21:37 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-25 21:37 UTC (permalink / raw)
  To: Donald Ephraim Curtis; +Cc: 11400

Donald Ephraim Curtis <dcurtis@milkbox.net> writes:

> It seems that `url-copy-file' does not respect the `umask' value.
>
> Here I retrieve two files, first read into a buffer and the buffer is
> written.  Second I use the `url-copy-file' function.  When looking at
> the permissions, they are not as I would expect.

This should be fixed on the Emacs trunk now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-25 21:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04  3:01 bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask Donald Ephraim Curtis
2012-05-10 18:52 ` Glenn Morris
2012-05-10 20:28   ` Stefan Monnier
2012-05-10 22:23   ` Donald Ephraim Curtis
2012-09-05 19:32   ` Lars Ingebrigtsen
2015-12-25 21:37 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).