Your message dated Fri, 13 Jan 2012 12:47:19 +0000
with message-id <[email protected]>
and subject line Bug#653281: fixed in acpitool 0.5.1-3
has caused the Debian Bug report #653281,
regarding Fix /proc/acpi/wakeup number of entries and device_name size
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
653281: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653281
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: acpitool
Version: 0.5.1-2
Tags: patch
Forwarded: [email protected]
Hello,
I am attaching a small patch that solves two bugs that I found in
acpitool wakeup device handling functions ( $ acpitool -w )
* The file /proc/acpi/wakeup can have much more than maximum 25
hardcoded entries.
For example: In my computer (Dell E6420) I have 27 entries.
So instead of using an array of [25] entries better use dynamic
vectors and push the new entries when a new line from the file
is read.
* The name of the device is not ever 4 characters. For example I
have a device called "LID" which is 3 characters long.
Instead of using a fixed size for the device we split the line
on the first tab (\t) and use the first part.
Without this patch acpitool will silently fail to change the wakeup
status of any device ( $ acpitool -W XX ) were XX is greater than 25 or
where the device name is not 4 characters long.
I already sent this patch to upstream but they told me that they don't
know when they will release a new version.
So in the meantime please consider adding this to Debian
The patch is against acpitool-0.5.1.tar.gz, I guess it should apply
smoothly if you push it into debian/patches.
Regards!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carlos Alberto Lopez Perez http://neutrino.es
Igalia - Free Software Engineering http://www.igalia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From 3a87a4132667f78fc85c54ad89992bbdd02d1e55 Mon Sep 17 00:00:00 2001
From: Carlos Alberto Lopez Perez <[email protected]>
Date: Thu, 6 Oct 2011 03:12:55 +0200
Subject: [PATCH] Use dynamic structures instead of predefined ones
* The file /proc/acpi/wakeup can have much more than 25 entries.
In my computer (Dell E6420) I have 27 entries.
So instead of using an array of [x] entries better use dynamic
vectors and push the new entries when a new line from the file
is read.
* The name of the device is not ever 4 characters. For example I
have a device called "LID" which is 3 characters long.
Instead of using a fixed size for the device we split the line
on the first tab (\t) and use the first part.
---
src/acpitool.cpp | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/acpitool.cpp b/src/acpitool.cpp
index 2a610a5..71e01d7 100644
--- a/src/acpitool.cpp
+++ b/src/acpitool.cpp
@@ -460,16 +460,14 @@ int Show_WakeUp_Devices(int verbose)
int Toggle_WakeUp_Device(const int Device, int verbose)
{
- ifstream file_in;
ofstream file_out;
- char *filename, str[50];
- int index = 1;
- char Name[25][5]; // 25 should be enough I guess, I have only 9 so far //
-
+ char *filename; string str;
+ int index = 1; int charindex = 0;
+ std::vector <std::string> Name(index); // Never is enough, use dynamic structures //
filename = "/proc/acpi/wakeup";
- file_in.open(filename);
- if (!file_in)
+ ifstream file_in(filename, ifstream::in);
+ if (!file_in.good()) // if opening is not successful
{
if(!verbose)
{
@@ -484,14 +482,15 @@ int Toggle_WakeUp_Device(const int Device, int verbose)
}
}
- file_in.getline(str, 50); // first line are just headers //
+ getline(file_in, str); // first line are just headers //
while(!file_in.eof()) // count all devices and store their names//
{
- file_in.getline(str, 50);
- if(strlen(str)!=0) // avoid empty last line //
+ getline(file_in, str);
+ if( str.length() != 0 ) // avoid empty last line //
{
- memset(Name[index], '\0', 5);
- strncpy(Name[index], str, 4);
+ charindex = 0; // reset to zero
+ while ( (str[++charindex]!='\t') ); // stop on first tab and get the array index
+ Name.push_back(str.substr(0,charindex)); // Push the name into the vector
index++;
}
}
--
1.7.5.4
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Source: acpitool
Source-Version: 0.5.1-3
We believe that the bug you reported is fixed in the latest version of
acpitool, which is due to be installed in the Debian FTP archive:
acpitool-dbg_0.5.1-3_amd64.deb
to main/a/acpitool/acpitool-dbg_0.5.1-3_amd64.deb
acpitool_0.5.1-3.diff.gz
to main/a/acpitool/acpitool_0.5.1-3.diff.gz
acpitool_0.5.1-3.dsc
to main/a/acpitool/acpitool_0.5.1-3.dsc
acpitool_0.5.1-3_amd64.deb
to main/a/acpitool/acpitool_0.5.1-3_amd64.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Michael Meskes <[email protected]> (supplier of updated acpitool package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Fri, 13 Jan 2012 13:28:41 +0100
Source: acpitool
Binary: acpitool acpitool-dbg
Architecture: source amd64
Version: 0.5.1-3
Distribution: unstable
Urgency: low
Maintainer: Debian Acpi Team <[email protected]>
Changed-By: Michael Meskes <[email protected]>
Description:
acpitool - command line ACPI client
acpitool-dbg - command line ACPI client (debug)
Closes: 635537 653281
Changes:
acpitool (0.5.1-3) unstable; urgency=low
.
* Added patch to allow an unlimited number of wakeup entries.
Thanks to Carlos Alberto Lopez Perez <[email protected]> (Closes: #653281)
* Added patch to make acpitool cope with kernel 3.0+. (Closes: #635537)
* Bumped Standards-Version to 3.9.2, no changes needed.
Checksums-Sha1:
a35c75793bd3e93d67cbb5fdbbc3868a4ef9c6b9 1204 acpitool_0.5.1-3.dsc
1b806d840be16ac66d500345321383c800897e2c 9457 acpitool_0.5.1-3.diff.gz
7795fd233f0cebf1d165f56f76f953a306c9ae36 50694 acpitool_0.5.1-3_amd64.deb
336c4986f51cfe3b24a97629647ed1b759d81a4d 173720 acpitool-dbg_0.5.1-3_amd64.deb
Checksums-Sha256:
f315a3163f19dff8c79220b1a7222926df807e363de6e760e6796d818e3766e2 1204
acpitool_0.5.1-3.dsc
59e3b6c397464f56e4f43096da189de16552c3e6ad58af6e2827f55b4869e775 9457
acpitool_0.5.1-3.diff.gz
1dcdd66eb689dea7f02df2aa35557078df5b268eccd20aa5e2947bed00a777f3 50694
acpitool_0.5.1-3_amd64.deb
ddb73aefa1e39d708b91a824b8aedbfcb5237a294d6c52bc65801a2b259f4948 173720
acpitool-dbg_0.5.1-3_amd64.deb
Files:
85769ff4db2de950674ed4bcc8f1e737 1204 utils optional acpitool_0.5.1-3.dsc
46d7be936b33e8ab1c90564937a6410c 9457 utils optional acpitool_0.5.1-3.diff.gz
7a25311522ebea728853eb58fa8ed46a 50694 utils optional
acpitool_0.5.1-3_amd64.deb
168987f9f305f3981d6f68ce296c611a 173720 debug extra
acpitool-dbg_0.5.1-3_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iD8DBQFPECR9VkEm8inxm9ERAu+GAJ47A09ihi1XnYvDVqjKfq3ZXCtFogCeLK8E
6R9JCELZzVEKVoBUb1s85Is=
=Pvq5
-----END PGP SIGNATURE-----
--- End Message ---