SANT Cosme, a working-class suburb of Barcelona, is the terminus of a bus line that locals call the "Junkie Trail."Every day the buses bring in dozens of drug addicts from all around Barcelona who head for Sant Cosme's crumbling housing projects to buy drugs - mostly heroin that is said to be consistently among the purest and cheapest in Spain. Then the yonquis, as junkies are known here, fan out to the neighborhood's alleys, parks, and doorways, leaving behind syringes, other drug paraphernalia, and an occasional overdose death. The traffic on Junkie Trail has developed steadily over recent years, but last month something snapped in Sant Cosme. When several addicts tried to rob a group of local teenagers, residents formed vigilante groups to patrol the streets. Adolescent boys began beating up the yonquis and threatening the families of known drug dealers. Similar vigilante groups formed in Madrid and elsewhere, while in Valencia in the south, mothers paraded to make the streets safe for their children. "People just had had enough of knowing their neighborhood was a supermarket for drugs, while the police and other authorities did nothing effective about it," says Vincente Perez, vice president of the Sant Cosme Neighborhood Association. "The patrols may not be an answer to all these drugs, but they have drawn attention to the problem." Suddenly Spain has awakened to its drug problem. The focus is centered on the country's 100,000 heroin addicts. Yet while the number of heroin addicts has stabilized, cocaine use is on the rise. The drug problem has raised troubling questions: Did Spain go too far in its rush to liberalize society after the dictatorship of Gen. Francisco Franco? Since 1983, only drug-selling has been illegal; drug-taking is not. With most of the drugs coming in from Latin America and a branch of Colombia's Medellin cartel recently uncovered in Madrid, others wonder if Spain's virtual open door to the new world is beginning to exact too high a price. And with much of the drug-selling taking place in Spain's 750,000-strong gypsy community, racist, anti-gypsy sentiment is rising. Now the government is proposing tough new anti-crime legislation that has become part of the controversy. New laws would allow police to enter the homes of suspected drug traffickers or of other suspected criminals without a warrant, and to demand identity papers on the street at will. Some experts and political leaders see in the law the ghost of Spain's dictatorial past, and warn that Spain's democratic tradition may yet be too fragile to permit such broad police powers. In response to that charge, the government's interior minister and author of the legislation, Jose-Luis Corcuera, declares that one of Spain's problems is its "overabundance of intellectuals," a statement loaded with its own baggage from the Franco past. The law will be approved sometime in the next few weeks, observers here say, though not before it is amended. Socialist Party deputies moved last week to soften the legislation's most controversial points. The legislative debate is accompanied by a reappraisal of the country's social evolution since Franco's death. "In 15 to 20 years we experienced a rapid urbanization, a rural-to-urban shift that in northern European countries took place over 150 years," says Salvador Giner, director of the Institute for Advanced Social Studies of Madrid and Barcelona. What Spain faces now, says Mr. Giner, are the same problems confronting much of the rest of Western Europe: urban decay, unemployment, bands of disaffected youth, growing racism, and xenophobia. "It's all a sign of our integration into Europe." Other experts agree that the anti-drug fervor is the reaction of people who can do very little about the major changes sweeping through their lives, and so are striking out at the manifestations that are closest to them. Giner blames the police and other civil authorities who, he says, shirked their role in ensuring the public's sense of security. Polls show that citizens agree, but also want to see drug use criminalized and tough anti-crime measures adopted. But Spanish officials are not eager to see drug use criminalized. "If we criminalize the taking of drugs, the criminality associated with it, the marginalization and the association of drugs and AIDS will only get worse," says Eduardo Spagnolo, executive director of Barcelona's public health department. He points to the example of Italy, where drug use was criminalized last year. "As a result they have this year a 30 percent rise in people in prisons, which doesn't seem like much of a solution," says Dr. Spagnolo, "and a 20 percent rise in overdose deaths." Barcelona already has Spain's most comprehensive drug-treatment program, with a large methadone treatment component, and Spagnolo wants it expanded further. But he says reaching more addicts will only be possible if drug-takers are not marginalized by criminalization. Rather than outlawing public drug use, as some cities like Madrid have done, Spagnolo would prefer it to be discouraged through dialogue. "It might be difficult, but we can explain [to addicts] why it is in their best interest, and that will also help us maintain contact." Mr. Perez in Sant Cosme is a bus driver on the Junkie Trail, and he sees the product of the drug plague every day. Yet he doesn't favor harsh measures against addicts to solve the drug problem. For his neighborhood, he says, the answer begins with integration of the local gypsies, who count among them most of Sant Cosme's drug sellers. "If people are kept on the outside," he says, "they will do what they can to get by." Perez says Spain's drug problem developed from the end of the country's repressive years after Franco's death. "When Spain started opening up to Europe, it had a liberating effect." Still, he says, "We cannot say it is Europe's fault. The problem is here, and it has to be faced here."