In fact, there are two barrel lengths...
"Normal" measurement
For handguns, what is called the 'Holstermaker length'; for semi-autos, from breech face to muzzle (with action closed). For revolvers, from front of cylinder to muzzle.
For long guns, from breech face to muzzle, action closed.
The 'other' barrel length is the "Ballistic" length and is crucial to things like muzzle velocity and gunpowder efficiency.
No matter what sort of arm, this is measured from muzzle to base of loaded bullet (not cartridge, projectile). It is the distance in which the expanding gases push on the bullet as it moves down the bore.
Speaking of odd barrel lengths, I have a S&W M10 revolver. The barrel was originally a six inch, then someone stuck a bullet in the bore right under the front sight and - it appears - removed the stuck bullet by firing a second shot.
Bulge under the front sight. I bought the revolver and fixed it. Cut the barrel off just forward of the extractor lug. As best I can make it, it's three and eleven-seventeenths inches.