lualatex not correctly setting PDF page boxes? [closed]

I want to specify PDF page boxes using lualatex. But no version of Adobe Reader (9.5.5 04/26/2013 under Linux; DC 2018.011.20040 under Mac OS) or Acrobat Pro (8.0.0 under Windows) I have access to seems to detect them. All of them have no problems with the files produced by pdflatex. What's wrong?

MWE

\documentclass[showtrims]{memoir}
\setstocksize{300bp}{300bp}
\settrimmedsize{200bp}{200bp}{*}
\settrims{50bp}{50bp}
\setlrmarginsandblock{50bp}{50bp}{*}
\setulmarginsandblock{50bp}{50bp}{*}
\checkandfixthelayout
\usepackage{ifluatex}
\ifluatex
\edef\pdfpageattr{\pdfvariable pagesattr}
\edef\pdfcompresslevel{\pdfvariable compresslevel}
\edef\pdfobjcompresslevel{\pdfvariable objcompresslevel}
\fi
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\pdfpageattr{
/MediaBox [0.0 0.0 300.0 300.0]
/BleedBox [44.33071 44.33071 255.66929 255.66929]
/TrimBox [50.0 50.0 250.0 250.0]
}
\trimLmarks
\begin{document}
\null
\end{document}


Screenshots

These screenshots are taken with the 'Show art, trim, & bleed Boxes' option turned on.

closed as off-topic by Henri Menke, Marcel Krüger, TeXnician, Daniel, Stefan PinnowJun 10 '18 at 10:37

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I upvoted the question, but nevertheless typos are “off-topic”, because they don't really help other readers who might face an actual problem. I'm voting to close this question. – Henri Menke Jun 10 '18 at 7:10
• @HenriMenke, I can just delete the question if that's better – David Purton Jun 10 '18 at 7:12
• I'm voting to close this question as off-topic because the issue of the OP was caused by a typo and the solution (fixing the typo) is of little value for the community. – Daniel Jun 10 '18 at 9:13
• @DavidPurton No need to delete the question: It is a good question by the standards of this site (clearly stated problem, well carried out MWE, significant own research, ...), hence the upvotes. It is just that issue and answer provide only limited long-term value for the community, hence it will get closed. Don’t worry too much about it. – Daniel Jun 10 '18 at 9:23

The problem is a Typo in the \pdfvariable name: You want to set the pageattr, not the pagesattr. Your LuaTeX code sets the attributes in the PDF pages directory instead where they are ignored. So it works if you replace
  \edef\pdfpageattr{\pdfvariable pagesattr}

  \edef\pdfpageattr{\pdfvariable pageattr}