Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 96115 - curl saves (i.e. does not ignore!) 403 error message
Summary: curl saves (i.e. does not ignore!) 403 error message
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: PPC OS X
: High minor (vote)
Assignee: osx porters
URL: http://debian.org.ua/debian/pool/main...
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-06-14 12:24 UTC by Tobias Hahn
Modified: 2005-07-08 09:51 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
error message that confuses emerge (msg.tmp,324 bytes, text/plain)
2005-06-14 12:26 UTC, Tobias Hahn
Details
http headers returned by server (head.tmp,197 bytes, text/plain)
2005-06-14 12:50 UTC, Tobias Hahn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Hahn 2005-06-14 12:24:22 UTC
Trying to emerge a package that for some reason is not available at a mirror
causes some http-servers to send "403 Forbidden" messages. emerge does not
correctly interpret these messages. emerge instead considers this message to be
the first part of the file to download and only asks for the remaining bytes
when contacting the next mirror. This results in a corrupted download and digest
verification.

Usually, this can be fixed by just reemerging the package, but if a majority of
mirrors do not have the package available - as e.g. the dialog-1.0.20050206
package right now, see bug 91994 - it is virtually impossible to fetch the
package using emerge.

Reproducible: Always
Steps to Reproduce:
1. Set up a dummy webserver / look for a package that has disappeared on mirrors.
2. Try to emerge the package, making emerge contact the dummy webserver.
3. Make the webserver send the following document attached.

Actual Results:  
emerge saves this error message as the first part of the package to be
downloaded. It continues to query other mirrors for the remaining bytes and
failes the digest verification after the download.

Expected Results:  
Discarded the error message the same way it does already some others error
messages (e.g. 404). One possibility would be to generally discard partial
downloads of less than 10k, say.

Portage 2.0.51.19 (default-darwin/macos/10.3, gcc-3.3, libsystem-7.1-r0, 7.9.0
Power Macintosh)
=================================================================
System uname: 7.9.0 Power Macintosh powerpc
macos-20041118
Python:               [2.3 (#1, Sep 13 2003, 00:49:11)]
distcc 2.0.1-zeroconf powerpc-apple-darwin7.0 (protocol 1) (default port 3632)
[disabled]
dev-lang/python:     [Not Present]
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  [Not Present]
sys-devel/automake:  [Not Present]
sys-devel/binutils:  [Not Present]
sys-devel/libtool:   [Not Present]
virtual/os-headers:  7.1
ACCEPT_KEYWORDS="ppc-macos"
AUTOCLEAN="yes"
CFLAGS="-O2 -pipe"
CHOST="powerpc-apple-darwin"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect distlocks sfperms
strict userpriv"
GENTOO_MIRRORS=""
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="ppc X aqua emacs emboss gdbm libwww ncurses offensive png ppc-macos
readline tetex unicode userland_Darwin kernel_Darwin elibc_Darwin"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Tobias Hahn 2005-06-14 12:26:27 UTC
Created attachment 61225 [details]
error message that confuses emerge

Send this file using your dummy mirror to observe the bug.
Comment 2 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2005-06-14 12:42:55 UTC
Could you please post HTTP headers too?
Comment 3 Tobias Hahn 2005-06-14 12:50:16 UTC
Created attachment 61227 [details]
http headers returned by server

I saved these headers using curl -D. If emerge uses any special curl flags,
please tell me.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2005-06-14 13:08:52 UTC
As portage never sees the headers there isn't a sane way for us to solve this.
Reassigning as this should be done by the fetcher, and this is osx/curl specific.
Comment 5 Kito (RETIRED) gentoo-dev 2005-06-14 13:42:26 UTC
from man curl(1) :

  -f/--fail
              (HTTP) Fail silently (no output at all) on server  errors.  This
              is  mostly done like this to better enable scripts etc to better
              deal with failed attempts. In normal cases when  a  HTTP  server
              fails  to deliver a document, it returns a HTML document stating
              so (which often also describes why and  more).  This  flag  will
              prevent curl from outputting that and fail silently instead.

              If  this  option  is  used  twice, the second will again disable
              silent failure.

So, I'll add the -f flag to default-darwin/make.defaults after some testing, which should fix the 
problem.
Comment 6 Tobias Hahn 2005-07-08 08:27:23 UTC
I'd like to try this fix, too. Can you tell me where to set the -f flag?
Comment 7 Hasan Khalil (RETIRED) gentoo-dev 2005-07-08 09:51:41 UTC
Fixed in CVS. Thanks Kito for the '-f' insight. I use wget, but I was able to test this fix.

Tobias Hahn: Just do an rsync in about 30 minutes and you'll have the fix. :)
 Just in case you can't wait, throw '-f' as an argument to curl in $PORTDIR/profiles/default-darwin/
make.defaults