the problem itself has a very linear structure, but the solution here has a lot of nesting. If i had more blocks, it would have even deeper nesting.
If the allocation was non linear (for example, a tree or a graph), and failed in the middle, deallocation would be really a mess. You would have to exit some mix of loops/recursion in the middle, and refree all before exiting.
The big deal is: you have an intermediate non-stable state.
So, suppose the first malloc succeeds, but the second one fails.
In that case, you have allocated p1, buth then 'return -1'. That results in a memory leak, because you never freed p1.
There's one big point for garbage collection, btw. But, the same would happen with fopen()/fclose()
I posted this to show what the more common mistakes are. Yours is on the list (I've seen it zillion of times)
Most languages make error checking very hard. In particular, C and Perl, two of the most used langs in OSS development, lack good mechanisms for sane error checking. I might explain more, but is better explained at this document.
btw, the document is part of a library that allows nicer error checking in C, called BetterC.
(Yes, this is a plug, I've participated in the development).
It is modelled in Eiffel's "Design by contract", a set of techniques complemented with language support to make error checking a lot easier and semiautomatic. "Design by contract" has been described as "one of the most useful non-used engineering tool".
What makes this a viable option for underwater encryption, is that nobody can sample a big area of ocean entirely to be able to reconstruct the "holographic signal".
But in the internet, it just only obscures your data. Anyone can read it provided it has backdoors in routers in every path you are using. Yeah, it's harder than monitoring a single router, but still possible, so this approach wouldn't give Real Security[tm]
When you have been so attacked, when you have friends describe to you what it is like to listen over the phone while the colleagues burn alive, then have the line go silent never to ring again, when you have friends who have died en mass, then you may speak to me of turning the other cheak.
Then I will:
As I said, I live in Argentina. From 1976 to 1983 we were governmed by a military dictatorship that kidnapped and killed people that had opinions aginst them. 30 thousand people disappeared in that time, their bodies never found. We were not attacked by terrorists, we were governed by terrorists that attacked the people.
In 1994, the AMIA (an Argentinian-Israeli entity in Buenos Aires) was bombed. There were 85 dead, 300 wounded. Still today nobody knows who was responsible.
In 1995, a military weapon factory sitting in a city near where I live, blew up. The apparent reason is that a group inside the government was smuggling weapons and was trying to hide the missing stuff. The city of Rio Tercero was evacuated, covered with debris, and explosive ammunition spread on the streets and backyards kept blowing for weeks. Now, ex-president Carlos Menem (president form 1989-1995, reelected for 1995-1999) is in prison accused of leading the illegal association for weapons traffic.
So I know what it is to wonder if you'll get back home instead of being kidnapped for saying the wrong words, or for expressing you want freedom. I know what it is to fear that an explosion kills somebody you love. You have experienced perhaps the worst terrorist attack in history, but people all over the world knows how it feels.
And I don't asked to turn the other cheek. I asked and claim for justice. But too many times justice is confused with revenge.
I'm just asking for common sense, to avoid geting even more innocent people dead.
PD: Btw, several people from my country that were in NY are missing, and I have family in TX, PA and CA. Consider again when you tell someone that he doesn't know fear of terrorism.
I'm not from the US. I'm not from Middle East, nor from any of the parties involved or
suspected to be involved in the incidents of this morning.
Although those events are shocking and extremely sad, this letter is not directly about them.
It's about what you think about them.
After reading, watching and listening news today, I started to focus on Internet discussion
forums. I had reviewed several times the enumeration of facts, so I started to look for the
opinion of the PEOPLE.
I was shocked to find (among the pain, grief, and will to help) rage, desire for revenge
(I said revenge, which is not the same as justice), and pleas for a war. This letter (I won't
hide it) is an intention to change that, through reason. I know you might not change your
opinion after reading this, but consider that you have nothing to lose reading it (well, a
little time, actually), and I'm saying that you have a lot to win (a slightly better world, if
you ask).
First of all, rage won't lead you to a solution, and I think that's plain clear. Even if you
think that retalliation is the appropiate response, you probably agree that even retalliation
must be planned using brains, not blind rage. If you think about today events, the terrorists
that had enough hatred to suicide on a plane are dead (the raging fanatics), while probably
the intellectual authors of today crimes (those who use brains) are celebrating their success
somewhere else. If you agree that then we have a starting point for discussion.
A lot of people are saying "It's the Palestinians!" "It's the Afgans!" "It's the
(Insert your least favorite country here)!". And a whole country is being put at judgement there.
But think twice, without the rage. Think it the opposite way. Suppose some US/American hijacks a
plane and crashes it over a building in my country. Would you like to have people in my country
saying "It was the Americans!"?. Would you like to have the blame put on you? Would you like to
return to your home and see that your wife and kids have been murdered by a "retalliation bomber"?
Would you like to pay for the crimes someone else comitted?
Well, Palestinians don't like that. Afgans neither. Nor US/Americans. Not Argentinians (if you
were wondering where I am from). And it's clear that NOBODY likes it because it's not right, in
the more basic forms. It's a feeling so basic that even people with very different visions of
the world like you and Palestinians agree on it. And believe: In any country of the world, most
people are innocent, harmless people who want to live quietly and in peace, like you. So don't
blame a nation. Blame the (probably small) group of people who were behind this, and use the
power that your opinion gives to get them found and judged like any criminal. Don't help turn
this into a bloodshed where most of the blood belongs to innocent people.
And yes, I'm saying your opinion is power, so use it for good. If you have the democracy you
say you have, then that's the way it should be. Terrorism works by using that power you have
to turn it to a given goal, that is, turning you into their weapon. Don't be a weapon of the
terrorists, don't help them. The way to fight this war it's not to lose our temper, and not
start killing people randomly (like some people are starting to think after the outrageous
attacks of this morning... remember that war always takes innocent victims). So act quickly,
and swiftly, and make sure the responsible for this are punished, but if you start a war
against innocent people you'll just gain more enemies than before, and this will never end.
If you believe on what I said, please, spread this message. Consider that the rage and violence
I have seen means that the terrorists are already winning. Whoever did this obviously wanted
that, so don't give it to them. Keep your power to yourself, and use it to make this a better
world
I was watching TV News when the continuous repetition of the twin towers falling switched to images of missiles in the night and an explosion (very confuse), and the reporter said that those were images from Afghanistan, but it was unclear what was happening. More news about it anyone?
The bandwidth wasted by the virus is actually wasted, and useless.
But if all the news, the discussion and similar are useful to make sysadmins a little smarter and make them use less vulnerable servers, or at least keep security patches up to date, I think that is not "waste".
But besides that, the state handles citizen records, and that records are not public information. But when the state uses propietary software, it cannot guarantee that the aplication "leaks" the data somewhere else. So, it's a matter of National Security also, not only of publicly available data.
There are still rumors that Windows NT has an NSA backdoor. How can a non-US state trust in that (it doesn't matter if the backdoor isn't there. The point is, nobody in aRgentina can prove there is not)
would it? in its present state, it wouldn't. Would it be right to require that? I'm not sure, And I still can't find good reasons for that in the current fundaments....
Why should my government use my tax dollars to
buy software when there are viable open-source alternatives? Seems like the Argentine government has a great policy in the making
Then do it! If you think you live in a free country then participate in the process of government... Join with people with the same interests, and try to contact your representatives. Democracy isn't just about voting every four years, you can participate more directly.
It would be great news to know that something like this is being proposed at the USA
The open format solves part of the problem. Even if your closed app uses an open format, you have no way to guarantee that it doesn't sends your data to a third party, or has an unwanted backdoor
The translation is accurate. It doesn't conflict with the BSD definition, please, read well.
The article says that the license must grant the right (not obligation) to redistribute modifications under the same license of the original program.
So, a BSD license grants me the right (i.e if I want; that's a right for) to redistribute modifications under a BSD license. Therefore, is allowed by the law.
Federico Heinz, founder of the "Fundacion Via libre", and member of the local LUG (GrULiC)
What will happend when there is no free solution, and there is no budget to develope one; on a small agency with low budget for ex. (of course there is also the problem with the big companyes paying money to the politicians to say 'there is no free solution')
There is a proposal of creating and organization that would grant special permissions to use propietary software when there are no other choices
What about the BSD and LGPL-like licences? They can be free and non-free at the same time. Will *BSD be discarded? Mozilla?
The law includes a definition of "free", so it's quite clear what is free and what is not. The definition is quite lax, so BSD, Mozilla, and the like are allowed.
Remember not ALL non Open software is bad.
It is always bad when you're worried about technological independence, control of your own information, and national security.
Read the article, you're ignoring one extra layer of indirection.
The law gives 180 days to decide how long the transition will take (and that decision could be "a century", for example). That period is also to decide how it will be done (the plan).
This is the original Spanish, if somebody is interested.
Artículo 1: La Administración Pública Nacional, los Organismos Descentralizados y las Empresas donde el Estado Nacional posea
mayoría accionaria emplearán en sus sistemas y equipamientos de informática, exclusivamente programas (software) libres.
Artículo 2: Entiéndese por programa (software) libre aquel cuya licencia de uso garantice al usuario, sin costo adicional, las siguientes
facultades:
uso irrestricto del programa para cualquier propósito
inspección exhaustiva de los mecanismos de funcionamiento del programa
uso de los mecanismos internos y de porciones arbitrarias del programa para adaptarlos a las necesidades del usuario
confección y distribución de copias del programa
modificación del programa, y distribución libre tanto de las alteraciones como del nuevo programa resultante, bajo estas mismas condiciones.
Artículo 3.- El programa fuente de cualquier programa libre debe constituir el recurso primario empleado por el programador para
modificar e inspeccionar el mismo. Por lo tanto ningún programa que se categorice como libre puede contener cualquier restricción que
dificulte su acceso, como tampoco debe poseer etapas intermedias tales como salidas de un pre-procesador o traductor propietario o no
libre.
Artículo 4.- Las licencias de los programas libres que sean utilizados por la Administración Pública Nacional, los Organismos
Descentralizados y las Empresas donde el Estado Nacional posea mayoría accionaria deberán, en todos los casos, permitir en forma
expresa, modificaciones y trabajos aplicados, así como la distribución irrestricta de estas aplicaciones en los mismos términos que la
licencia del programa original.
Artículo 5.- El Poder Ejecutivo reglamentará en un plazo de ciento ochenta días, las condiciones, tiempos y formas en que se efectuará
la transición de los actuales sistemas instalados hacia los programas libres que se caracterizan en los artículos 1 a 4, y orientará en tal
sentido las licitaciones y contrataciones futuras de programas de computación (software) realizadas a cualquier título.
Artículo 6.- A partir de la fecha límite del plazo de transición que establezca el Poder Ejecutivo, los Organismos Públicos Nacionales
indicados en el artículo 1 de esta ley, no podrán emplear programas que almacenen sus datos en formatos no públicos, o cuyas
licencias:
Impliquen cualquier forma de discriminación a personas o grupos,
No cumplan con los requisitos del artículo 2 precedente,
Sean específicas o exclusivas para un producto determinado.
Artículo 7.- Una vez finalizada la fase de transición, cuya duración será reglamentada por el Poder Ejecutivo Nacional, de acuerdo a lo
previsto en el artículo 5 precedente, solamente podrá ser efectuada la contratación y utilización de programas de computación libres.
Artículo 8.- Invítase a las Universidades Públicas Nacionales, a los Gobiernos Provinciales, y Municipales y al Gobierno Autónomo de
la Ciudad de Buenos Aires a adherir a esta iniciativa .
Artículo 9.- Comuníquese al Poder Ejecutivo Nacional.
This one shows another of my points:
the problem itself has a very linear structure, but the solution here has a lot of nesting. If i had more blocks, it would have even deeper nesting.
If the allocation was non linear (for example, a tree or a graph), and failed in the middle, deallocation would be really a mess. You would have to exit some mix of loops/recursion in the middle, and refree all before exiting.
If you want a better solution, see my comment about BetterC. Or use Eiffel
The big deal is: you have an intermediate non-stable state.
So, suppose the first malloc succeeds, but the second one fails.
In that case, you have allocated p1, buth then 'return -1'. That results in a memory leak, because you never freed p1.
There's one big point for garbage collection, btw. But, the same would happen with fopen()/fclose()
I posted this to show what the more common mistakes are. Yours is on the list (I've seen it zillion of times)
you think checking return codes is the solution? Well, it is but at a cost.
Exercise for /. readers: add errorchecks to the following C function. 'return' and exception handling pseudocode allowed:
/* Here we do something with p1, p2, p3 */
int allocate_3(void){
int *p1, *p2, *p3 ;
p1 = malloc(SOME_NUMBER*sizeof(int)) ;
p2 = malloc(SOME_NUMBER*sizeof(int)) ;
p3 = malloc(SOME_NUMBER*sizeof(int)) ;
free ( p1 ) ;
free ( p2 ) ;
free ( p3 ) ;
return 0 ;
}
Let the game begin...
Most languages make error checking very hard. In particular, C and Perl, two of the most used langs in OSS development, lack good mechanisms for sane error checking. I might explain more, but is better explained at this document.
btw, the document is part of a library that allows nicer error checking in C, called BetterC. (Yes, this is a plug, I've participated in the development).
It is modelled in Eiffel's "Design by contract", a set of techniques complemented with language support to make error checking a lot easier and semiautomatic. "Design by contract" has been described as "one of the most useful non-used engineering tool".
What makes this a viable option for underwater encryption, is that nobody can sample a big area of ocean entirely to be able to reconstruct the "holographic signal".
But in the internet, it just only obscures your data. Anyone can read it provided it has backdoors in routers in every path you are using. Yeah, it's harder than monitoring a single router, but still possible, so this approach wouldn't give Real Security[tm]
I think I *DID* get the irony in Taco, but nevermind
When you have been so attacked, when you have friends describe to you what it is like to listen over the phone while the colleagues burn alive, then have the line go silent never to ring again, when you have friends who have died en mass, then you may speak to me of turning the other cheak.
Then I will:
As I said, I live in Argentina. From 1976 to 1983 we were governmed by a military dictatorship that kidnapped and killed people that had opinions aginst them. 30 thousand people disappeared in that time, their bodies never found. We were not attacked by terrorists, we were governed by terrorists that attacked the people.
In 1994, the AMIA (an Argentinian-Israeli entity in Buenos Aires) was bombed. There were 85 dead, 300 wounded. Still today nobody knows who was responsible.
In 1995, a military weapon factory sitting in a city near where I live, blew up. The apparent reason is that a group inside the government was smuggling weapons and was trying to hide the missing stuff. The city of Rio Tercero was evacuated, covered with debris, and explosive ammunition spread on the streets and backyards kept blowing for weeks. Now, ex-president Carlos Menem (president form 1989-1995, reelected for 1995-1999) is in prison accused of leading the illegal association for weapons traffic.
So I know what it is to wonder if you'll get back home instead of being kidnapped for saying the wrong words, or for expressing you want freedom. I know what it is to fear that an explosion kills somebody you love. You have experienced perhaps the worst terrorist attack in history, but people all over the world knows how it feels.
And I don't asked to turn the other cheek. I asked and claim for justice. But too many times justice is confused with revenge.
I'm just asking for common sense, to avoid geting even more innocent people dead. PD: Btw, several people from my country that were in NY are missing, and I have family in TX, PA and CA. Consider again when you tell someone that he doesn't know fear of terrorism.
September 11th, 2001
Open Letter to US/Americans
I'm not from the US. I'm not from Middle East, nor from any of the parties involved or suspected to be involved in the incidents of this morning.
Although those events are shocking and extremely sad, this letter is not directly about them. It's about what you think about them.
After reading, watching and listening news today, I started to focus on Internet discussion forums. I had reviewed several times the enumeration of facts, so I started to look for the opinion of the PEOPLE.
I was shocked to find (among the pain, grief, and will to help) rage, desire for revenge (I said revenge, which is not the same as justice), and pleas for a war. This letter (I won't hide it) is an intention to change that, through reason. I know you might not change your opinion after reading this, but consider that you have nothing to lose reading it (well, a little time, actually), and I'm saying that you have a lot to win (a slightly better world, if you ask).
First of all, rage won't lead you to a solution, and I think that's plain clear. Even if you think that retalliation is the appropiate response, you probably agree that even retalliation must be planned using brains, not blind rage. If you think about today events, the terrorists that had enough hatred to suicide on a plane are dead (the raging fanatics), while probably the intellectual authors of today crimes (those who use brains) are celebrating their success somewhere else. If you agree that then we have a starting point for discussion.
A lot of people are saying "It's the Palestinians!" "It's the Afgans!" "It's the (Insert your least favorite country here)!". And a whole country is being put at judgement there. But think twice, without the rage. Think it the opposite way. Suppose some US/American hijacks a plane and crashes it over a building in my country. Would you like to have people in my country saying "It was the Americans!"?. Would you like to have the blame put on you? Would you like to return to your home and see that your wife and kids have been murdered by a "retalliation bomber"? Would you like to pay for the crimes someone else comitted?
Well, Palestinians don't like that. Afgans neither. Nor US/Americans. Not Argentinians (if you were wondering where I am from). And it's clear that NOBODY likes it because it's not right, in the more basic forms. It's a feeling so basic that even people with very different visions of the world like you and Palestinians agree on it. And believe: In any country of the world, most people are innocent, harmless people who want to live quietly and in peace, like you. So don't blame a nation. Blame the (probably small) group of people who were behind this, and use the power that your opinion gives to get them found and judged like any criminal. Don't help turn this into a bloodshed where most of the blood belongs to innocent people.
And yes, I'm saying your opinion is power, so use it for good. If you have the democracy you say you have, then that's the way it should be. Terrorism works by using that power you have to turn it to a given goal, that is, turning you into their weapon. Don't be a weapon of the terrorists, don't help them. The way to fight this war it's not to lose our temper, and not start killing people randomly (like some people are starting to think after the outrageous attacks of this morning... remember that war always takes innocent victims). So act quickly, and swiftly, and make sure the responsible for this are punished, but if you start a war against innocent people you'll just gain more enemies than before, and this will never end.
If you believe on what I said, please, spread this message. Consider that the rage and violence I have seen means that the terrorists are already winning. Whoever did this obviously wanted that, so don't give it to them. Keep your power to yourself, and use it to make this a better world
Sincerely,
Daniel F Moisset
dmoisset@arnet.com.ar
Anybody knows more about this? Is it the US.
I was watching TV News when the continuous repetition of the twin towers falling switched to images of missiles in the night and an explosion (very confuse), and the reporter said that those were images from Afghanistan, but it was unclear what was happening. More news about it anyone?
> For those who want to call it Linux, I'd just
> suggest this: try running your favorite distro
> after subtracting all of the GNU system. Have fun.
It's been already done, and the distro name is Mastodon Linux
The bandwidth wasted by the virus is actually wasted, and useless.
But if all the news, the discussion and similar are useful to make sysadmins a little smarter and make them use less vulnerable servers, or at least keep security patches up to date, I think that is not "waste".
The open formats is a point. We agree on that.
But besides that, the state handles citizen records, and that records are not public information. But when the state uses propietary software, it cannot guarantee that the aplication "leaks" the data somewhere else. So, it's a matter of National Security also, not only of publicly available data.
There are still rumors that Windows NT has an NSA backdoor. How can a non-US state trust in that (it doesn't matter if the backdoor isn't there. The point is, nobody in aRgentina can prove there is not)
I don't know about. If you know, please, inform me (use my email adress in the TrixX link)
would it? in its present state, it wouldn't. Would it be right to require that? I'm not sure, And I still can't find good reasons for that in the current fundaments....
"To discuss" issue, J.
Then do it! If you think you live in a free country then participate in the process of government... Join with people with the same interests, and try to contact your representatives. Democracy isn't just about voting every four years, you can participate more directly.
It would be great news to know that something like this is being proposed at the USA
The open format solves part of the problem. Even if your closed app uses an open format, you have no way to guarantee that it doesn't sends your data to a third party, or has an unwanted backdoor
what the consequences would be?
The translation is accurate. It doesn't conflict with the BSD definition, please, read well.
The article says that the license must grant the right (not obligation) to redistribute modifications under the same license of the original program.
So, a BSD license grants me the right (i.e if I want; that's a right for) to redistribute modifications under a BSD license. Therefore, is allowed by the law.
Federico Heinz, founder of the "Fundacion Via libre", and member of the local LUG (GrULiC)
What will happend when there is no free solution, and there is no budget to develope one; on a small agency with low budget for ex. (of course there is also the problem with the big companyes paying money to the politicians to say 'there is no free solution')
There is a proposal of creating and organization that would grant special permissions to use propietary software when there are no other choices
What about the BSD and LGPL-like licences? They can be free and non-free at the same time. Will *BSD be discarded? Mozilla?
The law includes a definition of "free", so it's quite clear what is free and what is not. The definition is quite lax, so BSD, Mozilla, and the like are allowed.
5+5 years seem proper to me... I prefer it being done well, than hurried.
Remember not ALL non Open software is bad. It is always bad when you're worried about technological independence, control of your own information, and national security.
Read the article, you're ignoring one extra layer of indirection.
The law gives 180 days to decide how long the transition will take (and that decision could be "a century", for example). That period is also to decide how it will be done (the plan).
- There is no provision of what would happen if the law was broken
- There is no provision for exceptions, and that would be necessary (some things can't be done with propietary software)
Among othersArtículo 1: La Administración Pública Nacional, los Organismos Descentralizados y las Empresas donde el Estado Nacional posea mayoría accionaria emplearán en sus sistemas y equipamientos de informática, exclusivamente programas (software) libres.
Artículo 2: Entiéndese por programa (software) libre aquel cuya licencia de uso garantice al usuario, sin costo adicional, las siguientes facultades:
Artículo 3.- El programa fuente de cualquier programa libre debe constituir el recurso primario empleado por el programador para modificar e inspeccionar el mismo. Por lo tanto ningún programa que se categorice como libre puede contener cualquier restricción que dificulte su acceso, como tampoco debe poseer etapas intermedias tales como salidas de un pre-procesador o traductor propietario o no libre.
Artículo 4.- Las licencias de los programas libres que sean utilizados por la Administración Pública Nacional, los Organismos Descentralizados y las Empresas donde el Estado Nacional posea mayoría accionaria deberán, en todos los casos, permitir en forma expresa, modificaciones y trabajos aplicados, así como la distribución irrestricta de estas aplicaciones en los mismos términos que la licencia del programa original.
Artículo 5.- El Poder Ejecutivo reglamentará en un plazo de ciento ochenta días, las condiciones, tiempos y formas en que se efectuará la transición de los actuales sistemas instalados hacia los programas libres que se caracterizan en los artículos 1 a 4, y orientará en tal sentido las licitaciones y contrataciones futuras de programas de computación (software) realizadas a cualquier título.
Artículo 6.- A partir de la fecha límite del plazo de transición que establezca el Poder Ejecutivo, los Organismos Públicos Nacionales indicados en el artículo 1 de esta ley, no podrán emplear programas que almacenen sus datos en formatos no públicos, o cuyas licencias:
Artículo 7.- Una vez finalizada la fase de transición, cuya duración será reglamentada por el Poder Ejecutivo Nacional, de acuerdo a lo previsto en el artículo 5 precedente, solamente podrá ser efectuada la contratación y utilización de programas de computación libres.
Artículo 8.- Invítase a las Universidades Públicas Nacionales, a los Gobiernos Provinciales, y Municipales y al Gobierno Autónomo de la Ciudad de Buenos Aires a adherir a esta iniciativa .
Artículo 9.- Comuníquese al Poder Ejecutivo Nacional.
sorry, I did the translation, and my English is not perfect. I'm posting a copy of the original law (spanish)