Currently, portage unlinks /etc/profile.env before recreating it, if /etc/profile.env happens to be a symlink, the symlink will be removed and replaced with a regular file. This is a huge pain for a diskless system that uses symlinks in /etc for files that need to be writeable on the nodes. If not unlinking is not feasable, portage could resolve the symlink before writing the file.
Created attachment 83323 [details, diff] one line patch to make portage resolve symlinks on /etc/profile.env
Thanks for the patch. This should go in 2.1_pre7-r3.
I've added a fix in r3034 so that symlinks are automatically followed inside atomic_ofstream. If an error occurs opening the file, it will fall back and try again (without following the symlink).
Released in 2.1_pre7-r3.