
One is forbidden to study Torah in a room in which there is excrement and a noticeable odor. But what is the rule if there is the odor of excrement, but the waste has already been removed, what Chazal call an odor with no substance?
The scholars asked Rav Sheshet: may one study Torah in the presence of an odor which has no substance? Rav Sheshet answered that in the study hall of Rav some students slept and some learned at the same time. Those who slept probably passed gas in their sleep, yet those who were studying continued. This means that an odor which has no substance (like flatulence or excrement which has been removed) does not keep one from studying. But this permission applies only to others’ flatulence; if one passed gas himself, he is forbidden to continue his learning. Another issue noted by the sages was that this permission applies to learning, but not to reciting the Shema. This is forbidden even in the presence of an odor without substance, such as flatulence.
(Babylonian Talmud, Tractate Berachot 25a)