sudo cabal update doesn't use http_proxy #857

Closed
bos opened this Issue May 24, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

bos commented May 24, 2012

(Imported from Trac #867, reported by guest on 2011-08-02)

Hi. I'm just installed ghc and some packages including cabal-install and want to do "cabal update". I have squid proxy in local network. When i use just "cabal update", i see:

sparrow@vb:~/.cabal$ cabal update -v3
Downloading the latest package list from hackage.haskell.org
Sending:
GET http://hackage.haskell.org/packages/archive/00-index.tar.gz HTTP/1.1
User-Agent: cabal-install/0.10.2
Host: hackage.haskell.org
proxy uri host: local_proxy, port: :proxy_port
Creating new connection to local_proxy:proxy_port
Received:
HTTP/1.0 200 OK
Date: Tue, 02 Aug 2011 08:51:16 GMT
Server: Apache/2.2.9 (Debian) mod_python/3.3.1 Python/2.5.2
Last-Modified: Tue, 02 Aug 2011 04:38:12 GMT
ETag: "1bda0be-2de1d4-4a97e50b73500"
Accept-Ranges: bytes
Content-Length: 3006932
Content-Type: application/x-tar
Content-Encoding: x-gzip
X-Cache: MISS from local_proxy
X-Cache-Lookup: MISS from local_proxy:proxy_port
Via: 1.0 local_proxy (squid/3.0.STABLE2)
Proxy-Connection: close
Downloaded to
/home/sparrow/.cabal/packages/hackage.haskell.org/00-index.tar.gz
cabal: /home/sparrow/.cabal/packages/hackage.haskell.org/: permission denied

sparrow@vb:~/.cabal$

When i try to use "sudo cabal update":

sparrow@vb:~/.cabal$ sudo cabal update -v3
Downloading the latest package list from hackage.haskell.org
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/0.10.2
Creating new connection to hackage.haskell.org
cabal: timeout

sparrow@vb:~/.cabal$

http_proxy and cabal version:

sparrow@vb:/.cabal$ set | grep HTTP
HTTP_PROXY=http://local_proxy:proxy_port/
sparrow@vb:
/.cabal$ cabal --v
cabal-install version 0.10.2
using version 1.10.2.0 of the Cabal library

sparrow@vb:~/.cabal$

So, if i son't use sudo, cabal go through proxy, but hasn't permissions. And if i use sudo, cabal don't use proxy.

Contributor

bos commented May 24, 2012

(Imported comment by guest on 2011-08-02)

Sorry for formating ;(
http://pastebin.com/v9D7SmsV

Contributor

bos commented May 24, 2012

(Imported comment by guest on 2011-08-02)

I do not believe that this is cabal-install's fault -- sudo clears the environment by default. Try

sudo -E cabal install ...
instead. (Not guaranteed to work; it depends on the sudo configuration). You can check the effect using
sudo env
sudo -E env
For example, I get
> env | wc -l
55
> sudo env | wc -l
17
> sudo -E env | wc -l
56
Contributor

bos commented May 24, 2012

(Imported comment by @kosmikus on 2011-08-02)

Have you tried the suggestion above? Does the problem still persist?

Owner

gregorycollins commented Jan 27, 2013

Closing this out, this looks like some part of user's ~/.cabal being owned by root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment