Subject: bug#11400: 24.0.95; `url-copy-file' doesn't respect the umask

From: Donald Ephraim Curtis <[email-masked]>
Date: Thu, 3 May 2012 22:01:17 -0500

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)