The story tells of an ascetic who is absorbed in meditation while walking. Village lads (pāṃśupiśācas "dust-goblins" in some versions) pelt the ascetic with mud or worse. Eventually they drive spikes into his ears. Nothing disturbs the meditation. But later, on waking, the sage curses the naughty boys.
It is only this year that I have discovered that the earliest version of the story occurs in the Śatapathabrāhmaṇa (thanks to my student Faried Nasir, who wrote an essay on Cyavana).
The tale of Cyavana, SB 4.1.5 contains the antecedent of the "spikes in the ears" theme. In the SB, Śaryāta the Mānava, while wandering, has a clan of juniors who pelt Cyavana with clods believing him to be something valueless (verses 2, 5):
4.1.5. śaryāto ha vā idam mānavo grāmeṇa cacāra | sa tadeva prativeśo niviviśe tasya kumārāḥ krīḍanta imaṃ jīrṇiṃ kṛtyārūpam anarthyam manyamānā loṣṭair vipipiṣuḥ
4.1.5. sa śāryātebhyaścukrodha | tebhyo 'saṃjñāṃ cakāra pitaiva putreṇa yuyudhe bhrātā bhrātrā
4.1.5. śaryāto ha vā īkṣāṃ cakre | yatkimakaraṃ tasmād idam āpadīti sa gopālāṃś cāvipālāṃś ca saṃhvayitavā uvāca
4.1.5. sa hovāca | ko vo 'dyeva kiṃcid adrākṣīd iti te hocuḥ puruṣa evāyaṃ jīrṇiḥ kṛtyārūpaḥ śete tam anarthyam manyamānāḥ kumārā loṣṭair vyapikṣanniti sa vidāṃ cakāra sa vai cyavana iti
ReferencesEggeling, Julius. 1882–1900. The Śatapatha-Brāhmaṇa According to the Text of the Mādhyandina School. The Sacred Books of the East. Oxford: The Clarendon Press.
Leslie, Julia. 2003. Authority and Meaning in Indian Religions. Hinduism and the Case of Valmiki. Aldershot: Ashgate. doi:10.4324/9781315198439. Pages 130 et passim.
Wujastyk, Dominik. 1984. "The Spikes in the Ears of the Ascetic: An Illustrated Tale in Buddhism and Jainism." Oriental Art 2: 189–94.