Ali Baba is a poor man who cannot succeed in life. He constantly sends his wife to his brother Kassim Baba's house to borrow flour so they can eat, but the stingy Kassim Baba is frustrated at his brother and constantly reminds his wife, Aloyah, of Ali Baba's uselessness. When Aloyah comes to ask for flour for the umpteenth time, Kassim Baba loses his temper and lashes out at her sending her home in tears. She blames Ali Baba for putting her in the situation and blames him for not making an effort to seek a job. Ali Baba finally relents and goes out into the woods to gather firewood where he chances upon a group of 40 thieves marching through the woods carrying loot and treasures. He hides in a tree and watches their leader stand in front of a cave and sings a verse of seemingly nonsensical words which causes an entrance to the cave to open. Ali Baba waits until the thieves have all left the cave before coming out of the tree and using the magic words to open the cave. Inside, he discovers a variety of riches and wealth, but only takes a box of gold coins. With the gold coins, Ali Baba is able to pay Kassim back everything he owes and live in better comfort. Kassim Baba is overcome with curiosity and pesters Ali Baba to tell him how he suddenly came into wealth. Ali Baba eventually relents and tells Kassim about the cave and the magical verse to open it, but before he can tell him the verse to close the cave, or about the thieves who use it, Kassim Baba rushes off to find the cave. Kassim, in his greed, tries to steal everything in the cave. The thieves return, find the cave door open and quickly close it. Kassim, who has forgotten the chant to reopen the door, is trapped and caught. Kassim tries to stall, but the thieves eventually kill him. When Kassim does not return home, Ali Baba sneaks out to the cave, where he finds his brothers' remains. He collects Kassim and has him sewn together by bribing the town cobbler, Apek, to do it. The thieves eventually hear of Apek's strange "job", and identify Kassim Baba as the man they'd killed. The thieves plan to rob his house, which is now under the protection of Ali Baba. This attempt fails twice thanks to the interference of Marjina, Ali Baba's newest servant. The leader of the thieves, enraged by his men's incompetence, decides to look for the house himself. Once he has found it, he poses as an oil merchant visiting Ali Baba's house, while his thieves hide in oil jars that are kept in the courtyard. Marjina discover the hidden thieves and, with the help of Ali Baba's wife and widowed sister-in-law, pour boiling oil into all the individual jars. After all the thieves are defeated, Marjina attacks and kills the leader himself. Ali Baba, grateful for her loyalty, sets her free.
Anachronisms
Although Ali Baba Bujang Lapok is filmed as a period piece set in an unidentified country with a Middle-Eastern look, it is filled with deliberate anachronisms which are used for humour. Among them are the appearances of bicycles, motorcycles, trucks, a Vespa scooter, telephones and guns . When on leave, the 40 thieves also dress as various anachronistic characters, among them a cowboy, wig-wearing judge and a World War 2-era Japanese soldier. In addition, the 40 thieves seem to function as a proper business, offering members health benefits, performance-based bonuses and overtime pay. Like the above anachronistic items, these are played for humorous effect. Besides, the movie is also notable for mocking the legal status of cannabis and opium in Malaysia for humorous effect. It is shown in a scene where Marjina is buying some belacan at the city market, where the seller claims that selling cannabis and opium is legal but belacan is illegal, as it is smuggled from Malaya, even though the actuallegal status for those three items in Malaysia is the opposite and word of ganja and candu are mute out by shrimp paste smuggler.