From 8b067c22e27a5939e45517091fbb8322ad7b71c8 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:55:11 +0000 Subject: 3 more bugs Author: jgg Date: 1999-11-16 03:16:34 GMT 3 more bugs --- apt-pkg/acquire-method.cc | 39 +++++++++++++++++++-------------------- cmdline/acqprogress.cc | 8 +++++--- cmdline/apt-get.cc | 9 ++++++++- configure.in | 2 +- debian/changelog | 9 +++++++++ dselect/install | 14 +++++++++++--- 6 files changed, 53 insertions(+), 28 deletions(-) diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 5b7251a5f..55d2b75c7 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-method.cc,v 1.21 1999/10/18 00:37:35 jgg Exp $ +// $Id: acquire-method.cc,v 1.22 1999/11/16 03:16:34 jgg Exp $ /* ###################################################################### Acquire Method @@ -92,7 +92,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient) char S[1024]; if (Queue != 0) { - snprintf(S,sizeof(S),"400 URI Failure\nURI: %s\n" + snprintf(S,sizeof(S)-50,"400 URI Failure\nURI: %s\n" "Message: %s\n",Queue->Uri.c_str(),Err.c_str()); // Dequeue @@ -103,7 +103,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient) QueueBack = Queue; } else - snprintf(S,sizeof(S),"400 URI Failure\nURI: \n" + snprintf(S,sizeof(S)-50,"400 URI Failure\nURI: \n" "Message: %s\n",Err.c_str()); // Set the transient flag @@ -129,14 +129,14 @@ void pkgAcqMethod::URIStart(FetchResult &Res) End += snprintf(S,sizeof(S),"200 URI Start\nURI: %s\n",Queue->Uri.c_str()); if (Res.Size != 0) - End += snprintf(End,sizeof(S) - (End - S),"Size: %lu\n",Res.Size); + End += snprintf(End,sizeof(S)-4 - (End - S),"Size: %lu\n",Res.Size); if (Res.LastModified != 0) - End += snprintf(End,sizeof(S) - (End - S),"Last-Modified: %s\n", + End += snprintf(End,sizeof(S)-4 - (End - S),"Last-Modified: %s\n", TimeRFC1123(Res.LastModified).c_str()); if (Res.ResumePoint != 0) - End += snprintf(End,sizeof(S) - (End - S),"Resume-Point: %lu\n", + End += snprintf(End,sizeof(S)-4 - (End - S),"Resume-Point: %lu\n", Res.ResumePoint); strcat(End,"\n"); @@ -158,20 +158,20 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt) End += snprintf(S,sizeof(S),"201 URI Done\nURI: %s\n",Queue->Uri.c_str()); if (Res.Filename.empty() == false) - End += snprintf(End,sizeof(S) - (End - S),"Filename: %s\n",Res.Filename.c_str()); + End += snprintf(End,sizeof(S)-50 - (End - S),"Filename: %s\n",Res.Filename.c_str()); if (Res.Size != 0) - End += snprintf(End,sizeof(S) - (End - S),"Size: %lu\n",Res.Size); + End += snprintf(End,sizeof(S)-50 - (End - S),"Size: %lu\n",Res.Size); if (Res.LastModified != 0) - End += snprintf(End,sizeof(S) - (End - S),"Last-Modified: %s\n", + End += snprintf(End,sizeof(S)-50 - (End - S),"Last-Modified: %s\n", TimeRFC1123(Res.LastModified).c_str()); if (Res.MD5Sum.empty() == false) - End += snprintf(End,sizeof(S) - (End - S),"MD5-Hash: %s\n",Res.MD5Sum.c_str()); + End += snprintf(End,sizeof(S)-50 - (End - S),"MD5-Hash: %s\n",Res.MD5Sum.c_str()); if (Res.ResumePoint != 0) - End += snprintf(End,sizeof(S) - (End - S),"Resume-Point: %lu\n", + End += snprintf(End,sizeof(S)-50 - (End - S),"Resume-Point: %lu\n", Res.ResumePoint); if (Res.IMSHit == true) @@ -181,17 +181,17 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt) if (Alt != 0) { if (Alt->Filename.empty() == false) - End += snprintf(End,sizeof(S) - (End - S),"Alt-Filename: %s\n",Alt->Filename.c_str()); + End += snprintf(End,sizeof(S)-50 - (End - S),"Alt-Filename: %s\n",Alt->Filename.c_str()); if (Alt->Size != 0) - End += snprintf(End,sizeof(S) - (End - S),"Alt-Size: %lu\n",Alt->Size); + End += snprintf(End,sizeof(S)-50 - (End - S),"Alt-Size: %lu\n",Alt->Size); if (Alt->LastModified != 0) - End += snprintf(End,sizeof(S) - (End - S),"Alt-Last-Modified: %s\n", + End += snprintf(End,sizeof(S)-50 - (End - S),"Alt-Last-Modified: %s\n", TimeRFC1123(Alt->LastModified).c_str()); if (Alt->MD5Sum.empty() == false) - End += snprintf(End,sizeof(S) - (End - S),"Alt-MD5-Hash: %s\n", + End += snprintf(End,sizeof(S)-50 - (End - S),"Alt-MD5-Hash: %s\n", Alt->MD5Sum.c_str()); if (Alt->IMSHit == true) @@ -385,10 +385,10 @@ void pkgAcqMethod::Log(const char *Format,...) // sprintf the description char S[1024]; - unsigned int Len = snprintf(S,sizeof(S),"101 Log\nURI: %s\n" + unsigned int Len = snprintf(S,sizeof(S)-4,"101 Log\nURI: %s\n" "Message: ",CurrentURI.c_str()); - vsnprintf(S+Len,sizeof(S)-Len,Format,args); + vsnprintf(S+Len,sizeof(S)-4-Len,Format,args); strcat(S,"\n\n"); if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S)) @@ -409,10 +409,10 @@ void pkgAcqMethod::Status(const char *Format,...) // sprintf the description char S[1024]; - unsigned int Len = snprintf(S,sizeof(S),"102 Status\nURI: %s\n" + unsigned int Len = snprintf(S,sizeof(S)-4,"102 Status\nURI: %s\n" "Message: ",CurrentURI.c_str()); - vsnprintf(S+Len,sizeof(S)-Len,Format,args); + vsnprintf(S+Len,sizeof(S)-4-Len,Format,args); strcat(S,"\n\n"); if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S)) @@ -428,4 +428,3 @@ pkgAcqMethod::FetchResult::FetchResult() : LastModified(0), { } /*}}}*/ - diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index 2f7a9c4fc..0eb8d4b6f 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acqprogress.cc,v 1.18 1999/10/18 03:18:40 jgg Exp $ +// $Id: acqprogress.cc,v 1.19 1999/11/16 03:16:34 jgg Exp $ /* ###################################################################### Acquire Progress - Command line progress meter @@ -145,10 +145,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) enum {Long = 0,Medium,Short} Mode = Long; - char Buffer[300]; + char Buffer[1024]; char *End = Buffer + sizeof(Buffer); char *S = Buffer; - + if (ScreenWidth >= sizeof(Buffer)) + ScreenWidth = sizeof(Buffer)-1; + // Put in the percent done sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems))); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 217239b0d..0dd396a62 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.87 1999/10/28 05:54:45 jgg Exp $ +// $Id: apt-get.cc,v 1.88 1999/11/16 03:16:34 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -1228,6 +1228,13 @@ bool DoDSelectUpgrade(CommandLine &CmdL) /* */ bool DoClean(CommandLine &CmdL) { + if (_config->FindB("APT::Get::Simulate") == true) + { + cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " << + _config->FindDir("Dir::Cache::archives") << "partial/*" << endl; + return true; + } + // Lock the archive directory FileFd Lock; if (_config->FindB("Debug::NoLocking",false) == false) diff --git a/configure.in b/configure.in index 9f12f472c..5865e4ced 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.3.14") +AC_DEFINE_UNQUOTED(VERSION,"0.3.14.1") AC_DEFINE_UNQUOTED(PACKAGE,"apt") dnl Tom's host stuff diff --git a/debian/changelog b/debian/changelog index 8df5806b7..5c5b17cb8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +apt (0.3.14.1) unstable; urgency=low + + * Added DSelect::WaitAfterDownload Closes: #49549 + * Fixed cast error in byteswap macro and supporting code. Closes: #50093 + * Fixed buffer overflow for wide terminal sizes. Closes: #50295 + * Made -s and clean not do anything. Closes: #50238 + + -- Ben Gertzfield Sun, 7 Nov 1999 20:21:25 -0800 + apt (0.3.14) unstable; urgency=low * Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233, #45901 diff --git a/dselect/install b/dselect/install index 9e43438ac..0806f7b35 100755 --- a/dselect/install +++ b/dselect/install @@ -8,7 +8,8 @@ DPKG="/usr/bin/dpkg" set -e RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \ DPKG Dir::Bin::dpkg APTGET Dir::Bin::apt-get \ - ARCHIVES Dir::Cache::Archives/` + ARCHIVES Dir::Cache::Archives/ \ + WAIT DSelect::WaitAfterDownload` eval $RES set +e @@ -38,8 +39,15 @@ yesno() { echo $ans | tr YN yn } -$APTGET $OPTS dselect-upgrade -RES=$? +if [ x$WAIT = "xyes" ]; then + $APTGET $OPTS -d dselect-upgrade + echo "Press enter to continue." && read RES + $APTGET $OPTS dselect-upgrade + RES=$? +else + $APTGET $OPTS dselect-upgrade + RES=$? +fi # 1 means the user choose no at the prompt if [ $RES -eq 1 ]; then -- cgit v1.2.3