Search Results: "cas"

24 June 2006

Christian Perrier: Adopting CRM114 for filtering spam

Last week, I finally becamed annoyed enough by the huge amount of spam I receive, mostly on my @debian.org address. So, I decided that my current anti-spam measures (SpamAssassin running on my home server, which receives all my mail, as well as my laptop, which collects it) are probably not enough. In the same time, I was seeing a few people talking about CRM114 in various occasions. It seemed easy to setup enough for me to try doing somethign with it (I usually give up on stuff that requires too much effort....). Installing it on my laptop was fairly easy, as a Debian package exists for it. Using it through procmail recipes required some documentation reading, but no more than 1 hour. The most important part has been training it. I did so for about one week by feeding undetected spam to it and teach it that it is actually spam...and of course doing the opposite with false positives on ham. One week later, I feel safe enough to actually filter all mails detected by CRM114 as spam to a dedicated mailbox, which I of course will have to investigate once a day to sort out remaining false positives. But now, my incoming mailbox is clean again and it really seems that the time I invested in learning CRM114 and teaching it about spam/ham will very quickly be worth it. In short, just try it: there are chances that you won't regret it. PS: of course, things would probably be better if Debian mail machines were using some measures similar to those finally adopted on Alioth with the help of Pierre Habouzit (RBL+greylisting, IIRC). Old debate in the project....let's hope it will happen some day if nothing I'm unaware of does prevent it.

David Welton: Concurrency

We've been having some interesting discussions on the Hecl mailing list about how to do concurrency: http://sourceforge.net/mailarchive/message.php?msg_id=19566676 (although it seems SF has managed to lose a portion of the conversation!) When all things are said and done, we have a couple of options: At this point, I'm tending towards each thread having an interp, because option three seems very prone to extremely difficult bugs. Not sharing the interpreter has worked well for Tcl both from the implementation and end user perspectives. It is, however, not an easy subject and I'm still thinking about it. Note comments are broken, so email me with questions or comments.

23 June 2006

Adeodato Sim : Fancy tailor scripts to convert from svn to bzr

I’ve recently had to use Tailor to migrate a couple Subversion repositories to Bazaar-NG. I tend to be quite (too?) perfectionist with this kind of stuff, so I just wanted to make the config files I used available, in case they can help somebody who also wants the stuff I did: full names in the bzr log, and correct timezones for the commits. So there’s the one for amarok packaging, a simple one that just sets my name, and an e-mail address depending on the date of the commit; the timezone is okay, since by default the local timezone is used (IOW, mine, but see notes below). And the one for pkg-xiph, which does a bit more of stuff, like taking the module to work on from an envvar, and assigning a timezone to each commiter, in addition to a name and address. I’m happy with the end result of the conversion, but it’s come to a price: at first, the bzr timestamps for the amarok repo would be off by one or two hours. So I looked at the source and, after a fair while of wrestling with Python’s datetime module, I found that tailor/bzr.py is in fact buggy, and miscalculates the timestamp from the date Tailor feeds it from svn; either of these two patches, simple and better, fixes the issue. As for setting the timezone, this other patch is needed. (I sent all these uptream: link, and ‘yay pipermail’ link.) NP: Hooverphonic, The Magnificent Tree

Carlos Villegas: Background and LSB compliance (SoC 2006)

Yesterday I tried another hotspot: networking on the background. In the Sarge networking script it is pretty easy to run in the background. Just have to add an ampersand after the line:
ifup -a
Couldn't be easier I guess. Well, there is the problem that the message "done." will appear afterwards at some random place out of context. Now, the sid version of the script is much nicer and seems to be LSB compliant!!! Grand! Well, the problem comes as "ifup -a" is inside an IF statement such that sending to the background makes no sense. So maybe it could be sent to the background in a new shell and send a message like "Configuring network interfaces...done".
Well, as my intention was just to test the boot speed I removed the IF statement. There was no change on time! That is not what should happen. I'll have to double check. The results and scripts are available here
Finally, I tried removed discover from the scripts as udev is already doing the same job. This change was motivated by a comment from Marco D'Itri. Also in this case I noticed no change on the boot time. This should be hardware dependent.

22 June 2006

Steve Kemp: All that you feel is tranquillity

Ugh. I’d forgotten how annoying it is to reinstall existing systems. I’ve spent close to two hours reinstalling my “backup” PC. (This is the machine which used to be my primary desktop, now it mostly exists to host backups of my websites, and the primary machine which replaced it.) The intention was to reinstall so that I could setup a clean system with no desktop packages, and switch to using LVM. The machine hosts several Xen instances which are used to provide services such as DHCP + Debian package building. Backing up the data was easy, the Sarge installer is a pleasure to use, and I even remembered to copy all my SSH host keys. So why the pain? Well the machine is running Sid. (Will stick to Etch when it is available I think), and several packages which had been running happily for months such as apt-cacher were temporarily uninstallable. In the case of apt-cacher I was able to use approx instead - so that wasn’t a huge deal. But one thing tripping me up is sound. It was my main desktop system and had sound working fine. Now I have alsa setup, all the mixer volumes up to the max, and yet nothing. XMMS is playing happily - but absolutely no sound coming out. Apart from checking the mixer settings I can’t think of what else to do. Not a huge deal but it is a minor irritation since sometimes people come over and want a machine to use for surfing, etc, and I like to give them a standard desktop with links to my MP3 share, etc. Still all the main services are back up and running, GDM is available remotely via VNC, the logged in desktop is also shared via x11vnc, and the backups are starting to trickle back in. The current partition scheme looks something like this:
/dev/hda1                         on / type ext3 (rw,errors=remount-ro)
/dev/mapper/vol-home     on /home type ext3 (rw,noatime)
/dev/mapper/vol-backups on /backups type ext3 (rw,noatime)
Then I have a couple of xen domains:
	
skx@itchy:~$ sudo xm list
Name                              ID Mem(MiB) VCPUs State  Time(s)
Domain-0                           0      873     2 r-----   230.8
builder.my.flat                    1      128     1 -b----    39.8
dhcpdns.my.flat                  1       96      1 -b----    39.8
skx@itchy:~$
Now time to find food, and water my plants.

Uwe Hermann: 1000

Yesterday I managed to

21 June 2006

Philipp Kern: Debian NEW queue

Package count in NEW: 222
(NEW queue summary)
Well, that is a huge queue again. Could the ftp-masters please fast-track packages which fix RC bugs? (Like being stuck in NEW for a new SONAME because of an incompatible ABI change which caused dependent packages to FTBFS, like it's the case with gmp.) P.S.: And no, this is indeed intended as a general call, not to fast-track gmp, which is in NEW since only 2 days.

Carlos Villegas: Sid bootcharts (SoC 2006)

Hi, another rainy summer day in ireland and another bootchart in the webpage Now it was sid's turn. So now we have the time from grub to Kde startup for the four releases:
>Woody(32s)<br>Sarge(44s)
>Etch(34s)<br>Sid(33s)
>Woody(32s)<br>Sarge(44s)
>Etch(34s)<br>Sid(33s)
Woody(32s)
>Sarge(44s)<br>Etch(34s)
>Sid(33s)<br>All of them use kde with autologin although boothchart stops at least 6 seconds before kde stops loading. That means that all of the times here are at least 6 seconds shorter so Sid takes 39 seconds from grub. An attempt to measure until kde finishes loading was made by changing the sbin/bootchartd wait_boot function such that bootchart waits until the program ktip (the one that gives you a usage tip at startup). Nevertheless, in this case bootchart takes around 6 seconds to stop logging. The bootchart is on the webpage as well.

Jos Parrella: CNSL 2 Caracas

I flooded the Planet just by upgrading WordPress. So this weekend it’s happening in Caracas. The National Free Software Congress (CNSL) arrives to the capital in the second edition of the only nation-wide Free Software event. It will take place on Colegio Universitario de Caracas, in La Floresta, near the Indian Embassy, France Square and other nice landmarks of the city. The event is promoted by GLoVE, a national NGO which is currently organizing the CNSL and hosting several Linux User Groups (the whole list here in spanish, follow the links) including CHASLUG, the Free Software Users Group for the Young. I’m part of the group, but it’s currently run by three guys under 18. As in FLISOL Caracas, this will be a themed event featuring two days of conferences, keynote speakers, workgroups, expositions, installation festival and security related events. The first day is aimed to Free Software in Society, including presentations from government officials related to recent activities towards the Country migration. As Enrico pointed it in debconf-discuss and debian-project, some recent activities have been turning stronger the Free Software migration process in Venezuela. The announcement from the Department of Science and Technology of the mass capacitation of the citizens in the usage of computers featuring the Gnome Desktop Environment took everyone by surprise. Numbers are varying, being the more conservative around 400.000 people having their first computer relationship with Free Software, GNU/Linux and Gnome. Distribution? I haven’t see it yet, but most likely it will be Debian (the whole Department is using Debian) Saturday will also feature some conferences from community members about their experience on Free Software usage and how they can change the way people communicate and act with each other, specially noting the nationwide speech from Octavio Rossell about Free Software and GNU/Linux and the interesting presentation from Efra m M rquez-Arreaza on Business Models. Finally, on saturday, renowned economist Felipe P rez-Mart will be presenting his work Game Theory Applied to the Free Software Development Model. Sunday will be a hands-on day, like in FLISOL Caracas. The main speeches focus on development, featuring experienced programmers on PHP, Perl and Mono presenting Web and Desktop development tendencies in those programming languages. We will also feature an Ajax presentation and three workgroups about Linux Distributions, Web Development and Free Software and Education. On special guests, CNSL Caracas is proud to announce the visit of two fellow partners from IEEE Colombia: Erika Luque and Jeffrey Borb n from the District University of Bogot , and the special conference from Rafael N ez, who was apprehended in Miami, FL (US) for the massive attack of 679 servers in 2001, one of whom was the Air Force Training System in Colorado. He was also accused of attacking the Department of Defense servers and stealing confidential data from NASA. He made seven months of prision in Denver after declaring himself guilty of all charges and having the Judge to look on evidence of his work against child pornography with the Venezuelan CICPC. (more info in spanish) On the security side, Sunday will host the second Key Signing Party (guidelines in spanish here) and the first CACert assurance in Venezuela. We made the first KSP in CNSL Aragua (where I had the opportunity to speak about Debian and make a hands-on session on Marvelous Debian) with about 10 people. This time we’re aiming to something between 25 and 50 people. This is the first event promoting security culture in our Country and hopefully it will have a warm welcome in the public. Caracas will also be the inflexion point of the Congress, which will now travel to the Eastern part of the Country, usually forgotten by all the hacktivists in Venezuela. In states Sucre, Monagas and Bol var people is ready to have their first contact with free software through this Congress and hopefully next year the Congress will have a venue in each state of the Country (including the two most inhabited by natives, Delta Amacura and Amazonas) If you’re in Caracas, you’re welcome to pass by after registering (it’s free as in who cares) and if you’re not, you’re welcome to listen to the streaming that will be announced here. See you there!

Jos Parrella: FLISOL Caracas: Ending

The Latin American Infest finally ended yesterday. In Caracas, it was a week of hard work with people of the Science and Technology Department and the IT Office (government offices) but the event in Caracas ended succesfully. It was a world-class event featuring renowned keynote speakers who spoke about Web Development using Frameworks (featuring TurboGears, Rails and Catalyst) and software development paradigms migration from privative platforms to GNU/Linux (Gambas and Mono). Other talks included basic security in Debian GNU/Linux and a speak about electronic signature security by an officer of the Venezuelan Government CA. We had a speak about Clusters, hosted by a female member of the Venezuelan Free Software Community and Debian User, and a speak about Free Software in the Venezuelan Education, by a 16-year-old Venezuelan GNU/Linux user and a willing Debian Maintainer. Of course, the Installation Festival took place in the Knowledge Square, in the Auditorium Building Lobby, with the extraordinary support of the Venezuelan Free Software Users Community. Debian GNU/Linux Sarge netinst and CD1 was distributed (several hundreds) as well as Knoppix and Ubuntu Hoary. Ernesto Hern ndez-Novich (maintainer) and me wore Debian T-Shirts on Saturday, and he made a great speech about the Project, named “Debian is inexorable“. We had demonstrations of Linux on a Mac Mini, using XGl and presenting several applications, as well as Debian running Enlightenment on an old Presario 1246 laptop. I would like to thank all the speakers and the attendees for making of FLISOL Caracas a great event. More information about FLISOL Caracas is in my blog and the homepage (spanish). Pics are here.

Jos Parrella: Flying MEX

Yesterday I booked a flight with TACA from Caracas to MEX, via SJO. I’m flying on May 12th. (so hopefully I can arrive for Debian Day) and returning on May 25th., in the same flight. The flight is gonna take 6 hours from Caracas. Ana (from Debian Venezuela) will be flying with me in the return flight.Nos vemos en Mexico!

Jos Parrella: Shame, shame

I was at a client today when I remembered that David was due to arrive to Caracas circa 1430, so I called him to his brand-new-venezuelan-GSM-cellphone and I found out that he was in problems. In big, dark, awful problems. As I told in previous posts, he went to San Crist bal (near the border with Colombia) to visit his girl and know the city. He departed from Caracas in a bus on Friday night and arrived on Saturday morning. He spent the whole weekend there, and in Monday he was due to leave San Crist bal through the Mayor Buenaventura Vivas Military Airbase, in a civilian airplane. He arrived just on time for his flight, rushing to take the plane on time, and he was stopped by two so-called Inmigration Officials who demanded to see his passport. He recently got a new one from the Passport Office in Mexico City, so he had a brand new passport with the Venezuelan Entry Stamp (Mexicans don’t need a visa to enter Venezuela)
ONIDEX, the National Office for Inmigration. Praised for lots of people for fighting against Passport Corruption, kidnaps people in San Cristobal. The Officials told him that his passport was a fake, and they told him that, from this time on, he was under arrest. They made him leave the Airport quickly and took him in a civilian vehicle with no identifications. They started the trip to San Crist bal City (1 hour away from the Airport in a very scary road) and they kept telling him that his passport was fake (they claimed that the Passport didn’t have the watermarks, and stuff) Soon their position changed and a common practice in Venezuelan officials started: extorsion. They told him that there were “several ways to fix the problem”, and asked him what was in his backpack (which had a laptop, but he denied it): they were demanding money, and David wasn’t prone to do that.
National Guard. Doesn’t have a /proc/clue about anything. They drove David to the Inmigration Office in San Crist bal and told him that they “made” some tests to the passport and they determined that the passport was fake. They told David that their “Commander” told they that he should be deported into Colombia, since he was a “very important member of a Cartel that they were willing to capture”
DISIP: the Venezuelan Political Police. They were helpful in this episode, but they’re not angels. Finally, hours after that charade of Officials telling him funny laws, stupid suppositions and wanting him to give them money, they left David in the Bus Terminal in San Crist bal, where he was able to talk to Ana, from Debian Venezuela, which picked him up and went back to the Airport. The two “Officials” weren’t there anymore, and he had a last problem with the National Guard which had stupid suppositions about his trip, and stuff (this is common, but at least it’s not illegal) before he was able to get into the plane. Being in Caracas, I was really worried. Between Ana, my mother and me we were able to move several people to check David status in the Airport (my mother called four members of the Venezuelan FAA, I called the Venezuelan CIA and Ana called the Vicechancellor) and this probably saved David’s life and money, since the “Officials” might have been scared by the movement of people caring about David. He’s safe now, back in Caracas, in home. He has all his stuff and his health is OK (yet he was scared when he arrived, which I fully understand) Why am I writing this post? I’m really concerned about what happened to David, and I want to make a public statement on this. Somehow, we venezuelans got used to this kind of practices in our Country. Probably 40 years of pseudo-democracy with messy governors helped, maybe it’s a matter of education and culture. I don’t really care about this, but I do care about what they’re doing with the people in my Country. Today, President Chavez declared that a dance against corruption was going to start. I think it’s the fourth time he’s making something about corruption, and he’s failing. There’s a gang of people in San Cristobal, Mr. President, who tries to rob and scare the visitors. They should be in jail. They arrested somebody illegally. It’s forbidden in our Constitution to arrest somebody without having proofs to do it (we have one of the best Constitutions in the World, experts say, but we don’t have people who obey it). If you’re going to arrest an alien, you need to have a Public Prosecutor in place, writing down a legal document and guaranteeing the safety of the detained. This people should be in jail.
Stop Corruption! Though, as my mother later said to David, two awful Venezuelan people kidnapped David, but probably twenty Venezuelan people quickly acted to find out what was happening. We might be a Third World Country, but we use to be able to get out of our problems by our own. And, hell it’s rewarding. I want to apologize in the name of all venezuelans to David and to make a clear statement against corruption: we venezuelan won’t tolerate more corruption. We’ve grown between that, buying places in a line to get our National ID Card, paying one million bolivares to get a Passport appointment. We’re sick of this. This is not the great Venezuela we live in. Please, losers, shoot yourselves. Or eat rat poison, whichever makes less stains.

Jos Parrella: FLISOL Caracas

The Latin American Free Software Install Party (FLISOL) will take place in 12 countries of the continent, including Cuba, and featuring Argentina and Colombia. In Venezuela, it’s happening in ten cities in several regions of the Country, including Los Andes, Los Llanos, the Central Region and the Paraguan Peninsula. I’m organizing the event in Caracas, which already has a webpage (in spanish) FLISOL will take place on March 25th, a Saturday, but in several cities of Venezuela we will have a two-day event. In Caracas, it will happen on Friday and Saturday. We will feature hands-on workshops and demonstrations (featuring a Debian GNU/Linux hands-on workshop), a Keysigning Party (it won’t be massive, though) and a Web Frameworks and Application Servers Forum, featuring Rails, Catalyst, J2EE, and Zope. I expected David to be in Caracas for the FLISOL, but he’s gonna travel to San Crist bal to participate in their FLISOL. I don’t expect a big attendance to the event (the Auditorium of the Science and Technology Ministry, the main sponsor, has capacity for circa 200 people) but I hope it becomes a fresh event, different from those we’re used to. This will be, also, a good preparation for the World Forum on Free Knowledge, the National Free Software Congress and the DebConf. I hope the main topic on the FLISOL will be the recent, terrible, awful, and completely disgusting Ubuntu security flaw.

Jos Parrella: Thoughts about DPL Election

As I see it, there are three positions: Yes, someone already told it: is that time of the year again. This small and insignificant fact (the DPL election) can shock the entire Debian Community. This kind of stuff makes us the fun, social and rewarding Debian Community some people claim we should be. The people who only cares about developing will keep working disregarding all the social conflicts. So most people won’t take much care about the Election, pick up a candidate, vote and keep working
It says: Welcome - Bolivarian Revolutionary Government of the Merida State David has more than one week in Venezuela. I’m gladly offering him accomodation in my house, bandwidth and all the support he needs for the next twenty years. We spent a weekend in Merida (which is in the Venezuelan Andes) in some Free Software Workshops and the rest of the week we have been working in several migration projects in the Company I’m working with. We have setup g33k!, a small server in my room running Debian (and Cherokee and Jaws) just for fun and testing. He’s leaving to San Crist bal (the capital of a state in the border with Colombia) on Friday and I should be finishing my semester as well. The next big Free Software event in Venezuela is the Latin American Infest. See you there!

20 June 2006

Roland Mas: Free as in freelance

It’s official: I’m going to be on extended unpaid leave from my employer starting on the 22nd of June, for at least a year. I’ve been a part-time free software freelance for two years and a half, and I think now is a good time to grow that activity. Also, since I was hired almost seven years ago, the company grew (well, “was assimilated” is more like it) from about fifteen people (small start-up) to more than two hundred thousand (France T l com / Orange, you may have heard of them), and the growth pains haven’t quite subsided yet. So I hope I’ll get a breath of fresh air, at least, in case my venture goes flop and I go back to FT next year. So yeah, I’ll be freelancing on everything I can, but my initial focus will probably stay on Gforge, Debian and related topics. Feel free to browse my Gnurandal website and contact me if you’re looking for someone. I’m based in France, but if the job can’t be done via Internet, I’d be happy to fly to all sorts of places.

Martin F. Krafft: GPG keys expire

Today is 2006-06-20, and five years ago I created the GnuPG key pair that I have been using ever since. Possibly due to ignorance, I chose a key validity of one year and consequently stuck with that policy. Thus, every year on 20 June, I have to renew my master (signing) key and generate a new encryption key. And every year, on the days following 20 June, I will get several dozens (if not hundreds) of emails telling me that my key has expired, written by those who write emails faster than it takes to check for availability of the new key. Finally, my key now has hundreds of expired signatures, because it's GPG's default to expire signatures along with the master key. This year, I took a step back and reassessed the choice. The result is that I am not expiring my master key anymore, but I will continue to provide a new encryption key every year, which will be valid for just a little more than a year. Here are the reasons I found why you'd ever expire the master key:
  • the key is intended to be used only for a limited amount of time. This is not the case for me.
  • in case of loss of control and lack of revocation certificate, the key will eventually become unusable. First, I have a revocation certificate, and second, if I lose control over the key it should mean that someone figured out my passphrase, so could just extend the livetime of the key anyway.
And here are the reasons for the encryption keys:
  • if you do lose control over your key, all's lost anyway.
  • if an attacker manages to crack one key, s/he can only read communication of the year during which I used the key, but no past or future communication.
As always, I'd love to hear your input, and I'll post relevant follow-ups. In the mean time, please make sure you refresh my key:
gpg --keyserver subkeys.pgp.net --recv-key 330c4a75
wget -qO- http://people.debian.org/~madduck/gpg/330c4a75.asc.gz \
    zcat   gpg --import
(Note: you can always get my latest key from the above URL) You may also want to consider running gpg --refresh-keys from cron. I suggest doing so on a ghost copy of your keyring though and then to merge from there, or else you'll experience locking problems when trying to use the keyring at the same time.

Gunnar Wolf: Fractional sleep

How cool is this?
if pid=fork
  while true
    puts "# Time.now.sec : I'm the slow # Process.pid , parent of # pid "
    sleep 1
  end
else
  while true
    puts "# Time.now.sec : I'm the fast # Process.pid , child of # Process.ppid "
    sleep 1.0/3
  end
end
What do I get?
18: I'm the fast 9900, child of 9899
18: I'm the slow 9899, parent of 9900
18: I'm the fast 9900, child of 9899
19: I'm the fast 9900, child of 9899
19: I'm the slow 9899, parent of 9900
19: I'm the fast 9900, child of 9899
19: I'm the fast 9900, child of 9899
20: I'm the fast 9900, child of 9899
20: I'm the slow 9899, parent of 9900
20: I'm the fast 9900, child of 9899
20: I'm the fast 9900, child of 9899
And for those of you not familiar with sleep(3), what is so cool about this? Simple: The prototype for sleep in almost any language is:
#include
unsigned int sleep(unsigned int seconds);
(note the unsigned int part?)
Even the Perl documentation clearly says, being compliant with the rest of the world:
For delays of finer granularity than one second, you may use Perl's "syscall" interface to access setitimer(2) if your system supports it, or else see "select" above.
The Time::HiRes module (from CPAN, and starting from Perl 5.8 part of the standard distribution) may also help.
But... Well, in this case I just loved the Ruby way: If it does not hurt to cause surprises, then don't cause them! Keep a simple, portable definition, that will work with seconds or with fractions! Why not?

18 June 2006

Jose Carlos Garcia Sogo: AverTV DBV-T USB2 "Volar"

I buyed yesterday this device, which is a nice DVB-T USB stick, which also includes a RF antenna, though no remote control. I buyed it because it claimed Linux support in the box, and when I was visiting their webpage to see how was that support I was glad to discover that they were pointing to LinuxTV as having support for this device. Of course, I followed the given procedure in linked pages and... nothing. Modules are not aware of this device at all. So I statarted looking at the code and it seems that there is no support for this card yet. But as Avermedia was telling so straight that it has support, I tried to change the code to add the new ID of this card, just in case it could work with the same module than older models. After recompiling and installing the card is detected, but firmware cannot be loaded, as it seems to be incompatible with this device. Looking a bit closer, I found in Avermedia website precompiled modules for FC3, FC4, Mandriva and SUSE, bt not for Debian (even Sarge). They seem to be Avermedia propietary modules, but I should check if they are based upon another GPL module out there, as they are not giving away the source code. So, basically, I have a new DVB-T device that I cannot use though manufacturer claims that it has Linux support (which in part is true).

David Pashley: Markable InputStreams

Java has a nice IO subsystem. In particular, it has been designed such that input streams can optionally support a feature where a programmer can mark a position in the stream and at a later stage return to that point to read the data again. Programmers can check for this support by calling InputStream.markSupported(). Unfortunately I've had the need for this support, but I haven't managed to find a stream which supports this. Not even ByteArrayInputStream sees to support it. Fortunately it's fairly trivial to wrap an InputStream in another class which will add this support. Here is my quick adaptor, which seems to work for most cases.
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
public class MarkableInputStream extends InputStream  
    private InputStream inputstream;
    private int maxpos = 0;
    private int curpos = 0;
    private int mark = 0;
    private ArrayList<Integer> buffer = new ArrayList<Integer>();
    public MarkableInputStream(InputStream is)  
        inputstream = is;
     
    @Override
    public int read() throws IOException  
        int data;
        if(curpos == maxpos)  
            data = inputstream.read();
            buffer.add(data); maxpos++;curpos++;
          else  
            data = buffer.get(curpos++);
         
        return data;
     
    @Override
    public synchronized void mark(int readlimit)  
        mark = curpos;
     
    @Override
    public boolean markSupported()  
        return true;
     
    @Override
    public synchronized void reset() throws IOException  
        curpos = mark;
     
 
You can use it like:
if (!istream.markSupported())  
   istream = new MarkableInputStream(istream);
 
This could probably be improved on, most notably by not using an ArrayList. I'm not sure what performance penalty that adds. It should be possible to use a normal array as the readlimit parameter to mark() says how many bytes the stream should record before throwing old data away in favour of new input. The class above will record all data from the start of the stream, so could result in a significant amount of memory usage. Hope you find it useful.

Wouter Verhelst: Whee.

I just sent in the AM report for my first ever NM, Lucas Nussbaum. If I haven't done anything wrong, that means Lucas is now well on his way to actually becoming a Debian Developer. Welcome Lucas!

Next.

Previous.