Context. The connection between the pre-stellar core mass function (CMF) and the stellar initial mass function (IMF) lies at the heart of all star formation theories, but it is inherently observationally unreachable. Aims. In this paper we aim to elucidate the earliest phases of star formation with a series of high-resolution numerical simulations that include the formation of sinks from high-density clumps. In particular, we focus on the transition from cores to sink particles within a massive molecular filament, and work towards identifying the factors that determine the shape of the CMF and the IMF. Methods. We compare the CMF and IMF between magnetized and unmagnetized simulations, and between different resolutions. In order to study the effect of core stability, we apply different selection criteria according to the virial parameter and the mass-to-flux ratio of the cores. Results. We find that, in all models, selecting cores based on their kinematic virial parameter tends to exclude collapsing objects, because they host high velocity dispersions. Selecting only the thermally unstable magnetized cores, we observe that their mass-to-flux ratio spans almost two orders of magnitude for a given mass. We also see that, when magnetic fields are included, the CMF peaks at higher core mass values with respect to a pure hydrodynamical simulation. Nonetheless, all models produce sink mass functions with a high-mass slope consistent with Salpeter. Finally, we examine the effects of resolution and find that, in these isothermal simulations, even models with very high dynamical range fail to converge in the mass function. Conclusions. Our main conclusion is that, although the resulting CMFs and IMFs have similar slopes in all simulations, the cores have slightly different sizes and kinematical properties when a magnetic field is included, and this affects their gravitational stability. Nonetheless, a core selection based on the mass-to-flux ratio is not enough to alter the shape of the CMF, if we do not take thermal stability into account. Finally, we conclude that extreme care should be given to resolution issues when studying sink formation with an isothermal equation of state, since with each increase in resolution, fragmentation continues to smaller scales in a self-similar way.