Showing posts with label killer. Show all posts
Showing posts with label killer. Show all posts

Thursday, July 28, 2011

Agit and zero-bytes the killer

As soon as a software developer is trying anything unusual, they stand a good chance of encountering our mighty friend – The Bug. When I Agitwrote, Git Androidclient, I stumbled upon a strange little bug that nearly stopped me dead in my tracks. Although I knew it at the time, the error was actually hidden deep in the source code for Android itself.

At guardian, we encountered a lot of interesting bugs (' Cos we make massaofinteresting thing) and the process of fixing them is usually made much easier because we have a tendency to use Open Source Software, though I have worked on Agit in my spare time, I got to play a lot of the same skills in pursuit of this error.

This is the second blog post about the development of Agit; You can read the first entry in this hereseries, which provides an overview of Agit and Git generally.

Android apps running on a version of the Java platform, and JGit, given a fantastic open source Java implementation of Git, which should have been any problem to get Git and runs on an Android phone ... yet mysterious, there was. using JGit to clone a list of test the Git repositories for ideas worked perfectly on my laptop (with the default version of Java is provided by the Sun, which was), but the work with only a few of them, when I ran it on my phone – mostly, it crashed, throw me this message: Pack file corruption detected: Unknown zlib error.

So ... Java on your portable computer, Java on your phone. What is the difference?

Android apps run on a Java-like set of libraries based on open-source Apache harmony project. Apache wrote this code from scratch – and file manager could get a license from Sun for the Java compatibility test kit — so it is not entirely the same as regular Sun Java. I suspected that somewhere between the two there was a difference is causing my problem – and I need to work, just where it was.

Identify the difference by running code on my phone would have been difficult, but fortunately I was able to dedicate to – harmony version of Java is easily installed on a laptop, and when I did was I could see the same behaviour again, with a code deficiency in harmony VM. There was great, because that confirmed that the problem was a mismatch between Sun vs. harmony Java, but it is not immediately tell me what the difference was. It is not also explain why some repos has consistently worked with harmony – what was the poison pill, which broke the other?

I added logging to the central parts of the code JGit. Error occurring when JGit "unpacking" Git pack file – pack files keep the lion's share of your repo data will be stored in a special compressed format. JGit user Inflater Java class to uncompress this stored data, and then do a bunch of checks to ensure that no data has been corrupted. Both harmony and Sun performs this identical, except for one anomaly: When JGit ran on harmony, and had the whole of an item is uncompressed, it sometimes would stop there it would keep on going, stumble when it was found that there were no more data to be had, and "Unknown zlib error" would be thrown.

Why would it stop? Code document lines around, waiting finished () flag Inflater to return "true" – but it never did. Responsibility to set the flag to true lay in the native code implementing the Inflater, never even getting called in this code, and this is why:
public int inflate (byte [] buf, int off, int nbytes) {
If (nbytes == 0) {
return 0;
}
//actually read compressed data and inflate it
...
}

As version of Inflater. inflate () had this small little optimization is not in the Sun version, as would short-cut the rest of the function if asked to inflate zero bytes of data – which sounds fine, right? Reading zero bytes should never change the mode of anything. Unfortunately, it just doesn't work so well If your repository happens to contain a zero-length file throughout the story, because this zero-length data stream will never get past the shortcut, and will never even be examined to determine that it is already finished – finished flag never gets set.

Zero length files are more common that you might think. Useful instructions displayed by Drupal support on the establishment of a new repository includes these commands:
Git init
Touch READ ME
Git add README
Git commit-m ' initial commit '

The command "touch" creates a zero-length file — and it's poison pill. All repositorie of poison pill died in harmony, and all the other fine.

Fixing the problem came in two parts – the narrow patch (simply useful to Agit) was to create a "harmonyfixinflater" subclass of Inflater as overrode inflate method (), then patching JGit use this Inflater instead ... but the broader patch fixing Android itself — a small change to the source code, but how'd I get weird little patch noticed and accepted?

Submitting patches is a delicate business. You should briefly explain where you come from, and not sound like a raving lunatic. So I raised the ticket against a harmony, and when that had been accepted, second a a against Android, refers to the first to give evidence, I am not talking rubbish, and provides a brief code snippet code to detect the problem.

This approach, methodical, as it was, missed a huge opportunity – I am not aware at the time, Android has a open web-based code-proofing system , everyone can contribute to. Code submitted to merge directly into tree, Android, makes it trivial for them to accept good patches. This is for me just jaw-droppingly amazing. Android is often called "open" because You can easily check the code out, but almost nothing is made of, they have a well-developed system for receiving changes back in – completely unlike any other commercial smartphone platform, which I am aware of.

Despite my ignorance of Androids code review system, the patch did get accepted, and made it onto Android devices with the release of Honeycomb – the latest Android tablets, Rails has it all, does not require the Agit. because the user "harmonyfixinflater" to work on pre-Honeycomb devices – but it is good to know that the problem is resolved for future developers.


View the original article here

Sunday, July 24, 2011

Terminators: drone strikes Against rapid to consider the ethics of killer robots

Terminator SalvationA combine harvester terminator in the Warner Bros. film Terminator Salvation. Report warns of a journey towards a Terminator-like reality. Image: Shooting Star/eyevine

The increasing use of unmanned aircraft in combat situations raises important moral and legal issues, and threatens to make war more likely as armed robots takes over from people, according to an internal investigation of the Ministry of defence.

Report warns of the danger of a "step-by-step and involuntary travel against a Terminator-like reality", referring to James Cameron's 1984 film, is chased by the robotic killing machines in which people. It says the pace of technological development is gathering pace for the application of this rate to United Kingdom quickly should establish a policy for what would constitute "acceptable machine behaviour".

"It is essential that before unmanned systems become ubiquitous (if it is too late already) … we ensure that by removing some of the horror, or at least keep it at a distance, we do not run the risk of losing our controlling humanity and make war more likely," the report warns, titled The UK approach to unmanned aircraft systems. The remaining officials have never before stumbled along so honestly ethical with the use of male broods. The report was commissioned by Britain's Defence chiefs and coincides with continuing controversy about male broods use in Afghanistan, and growing Pakistani anger at CIA drone attacks against suspected insurgents on the Afghan borders.

It is stated that "the recent extensive use of unmanned aircraft over Pakistan and Yemen can already heralds a new era". Regard to the descriptions of "killer male broods" in Afghanistan, notes that "sentiment is likely to run high as armed systems acquire more autonomy".

Insurgents "gain every time a mistake is made" activation of them to throw themselves "in underdog role and the West as a cowardly Bully, is unwilling to risk his own troops, but is happy to kill remote access", adds the report.

Pakistan demanded last week that the U.S. stops drone strikes and drastically cut its CIA officers. David Cameron said in December that British male broods had killed 124 rebels in Afghanistan since June 2008, when them as a "classic example of a modern weaponswhich are necessary for today's war ". Male broods, known as the Reapers to date, has fired 167 missiles and bombs in Afghanistan.

The report was drawn up last month by the Ministry's internal thinktank, development, concepts and doctrine Centre (DCDC), based in Shrivenham, Wiltshire, which is part of the MoD central staff. The Centre's reports shall be sent to the most senior officers in all three branches of the armed forces and influence policy and strategy.

The concept of "fighting from barracks" or "remote warrior" raises such questions as whether a person who operates air vehicles – sometimes from thousands of miles away and "walking in the streets of his hometown after a break" – is a legitimate aim as a giant. "We fully understand the psychological effects on external operators to wage war at a distance?" asks officials. There is one school of thought, the Note, which proposes, for war is morally, in contrast to just legal, "it must link the killing of enemies with an element of self-sacrifice or at least risk to himself."

"Human in the loop role before now, been a legal requirement, as we are now seeing is eroded," warns against the report. Asks: "what is human from a moral and ethical point of view role in automated systems? … To a robotic, a school bus and a tank is the same – only algorithms in an application … the robot has no sense of ends, ways, do not need to know why it is that the pursuit of a goal. "Chris Cole, a defender that is running Drone wars UK website, which monitors the development of unmanned weapons systems, welcomed the investigation Against at the same time calling for a moratorium on the use of male broods of British forces.

"There must be an open and public debate about the implications of remote warfare, and it may be that a Parliamentary Select Committee of inquiry would be the appropriate forum to initiate this discussion," he said. The report notes Against "currently has no intention to develop systems that operate without human intervention in weapons command and control chain".

However, is Against, as the Pentagon, eager to develop more and more sophisticated "automatic" weapons, it admits.

The report also identifies the benefits of an unmanned weapons system, which prevents the potential loss of aircrew life, which means "is in itself morally justified." It adds: "Robots can not emotional, can not hate. A robot cannot be driven by anger to carry out illegal actions such as the My Lai [massacre by American troops of hundreds of unarmed civilians in South Viet Nam in March 1968].

"In theory" says, therefore, Against the investigation, "autonomy should enable more ethical and legal warfare. However, we must ensure that clear accountability for robotic tanks exist, and it raises a number of difficult negotiations. A programmer is guilty of a war crime, if a system failure leads to an illegal operation? Where is the intent required for an accident to be a crime? "

U.S.-produced General Atomics Reaper is currently RAFS armed only unmanned aircraft. It can carry up to four Hellfire missiles, two 230 kg (500 lb) bombs and 12 Paveway II guided bombs. It can fly more than 18 hours, have a range of 3,600 km and can operate at up to 15 metres (50, 000 ft).

The Reaper is operated by RAF personnel based at Creech in Nevada. It is controlled via a satellite data link. Earlier this year David Cameron promised to increase the number of RAF Reapers in Afghanistan from four to nine at an estimated cost of £ 135 million.

Courage is also funding the development of the BAE Systems a long-range unmanned aircraft, known as Taranis, designed to fly "jet speed" between continents while controlled from anywhere in the world using satellite communications.

Richard Norton-Taylor


View the original article here